Skip to contentSkip to conversation

2.5.68 fs/ext3/super.c fix for orphan recovery error path

PATCH In review Ernie Petrides 3 participants 3 messages Apr 21, 2003 – Apr 28, 2003

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 2.5.68 fs/ext3/super.c fix for orphan recovery error path

Stephen/Andrew, please consider applying this patch to reverse the order of checks in ext3_orphan_cleanup() for read-only mounts and prior errors.

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.

Thanks in advance. -ernie

fs/ext3/super.c renamed from fs/ext3/super.c.orig +6 -6
diff -urpN linux-2.5.68/fs/ext3/super.c{.orig,}
@@ -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;
 
#1 lore raw
Quoted 4 lines · Ernie Petrides

Stephen/Andrew, please consider applying this patch to reverse the order of checks in ext3_orphan_cleanup() for read-only mounts and prior errors.

Thanks, that is definitely needed. We should do this in 2.4 as well.

#2 lore raw

Hi,

Quoted 7 lines · Andrew Morton
Quoted 4 lines · Ernie Petrides

Stephen/Andrew, please consider applying this patch to reverse the order of checks in ext3_orphan_cleanup() for read-only mounts and prior errors.

Thanks, that is definitely needed. We should do this in 2.4 as well.

Yes, I'll push it to marcelo.

--Stephen