From: Ernie Petrides <petrides@redhat.com>

The problem resolved by this patch is that if a root file system has an
error recorded from a previous mount, and then (when rebooting) the orphan
recovery procedure is initiated, the recovery is correctly skipped but the
file system is incorrectly left in a writable state.

This causes the subsequent fsck to fail due to the root file system
being dirty, and then requires manual intervention to get the system
fully booted.



 25-akpm/fs/ext3/super.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff -puN fs/ext3/super.c~ext3-ro-mount-fix fs/ext3/super.c
--- 25/fs/ext3/super.c~ext3-ro-mount-fix	Mon Apr 21 15:05:17 2003
+++ 25-akpm/fs/ext3/super.c	Mon Apr 21 15:05:17 2003
@@ -982,12 +982,6 @@ static void ext3_orphan_cleanup (struct 
 		return;
 	}
 
-	if (s_flags & MS_RDONLY) {
-		printk(KERN_INFO "EXT3-fs: %s: orphan cleanup on readonly fs\n",
-		       sb->s_id);
-		sb->s_flags &= ~MS_RDONLY;
-	}
-
 	if (EXT3_SB(sb)->s_mount_state & EXT3_ERROR_FS) {
 		if (es->s_last_orphan)
 			jbd_debug(1, "Errors on filesystem, "
@@ -997,6 +991,12 @@ static void ext3_orphan_cleanup (struct 
 		return;
 	}
 
+	if (s_flags & MS_RDONLY) {
+		printk(KERN_INFO "EXT3-fs: %s: orphan cleanup on readonly fs\n",
+		       sb->s_id);
+		sb->s_flags &= ~MS_RDONLY;
+	}
+
 	while (es->s_last_orphan) {
 		struct inode *inode;
 

_