Ext3, orphans and read-only

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
	I've seen a problem where on recovery after a crash the 
orphan cleanup code clears the read_only bit and does not reset 
it. This causes the the fsck to drop to the "fix filesystem" prompt 
simply because the root filesystem is now mounted rw. 

It looks like this:

Creating rootdevice
Mounting rootfilesystem
EXT3-fs: INFO: recovery required on readonly filesystem.
EXT3-fs: write access will be enabled during recovery.
kjournald starting.  Commit interval 5 seconds
EXT3-fs: sd(8,1): orphan cleanup on readonly fs
EXT3-fs: recovery complete.
EXT3-fs: mounted filesystem with ordered data mode.
Freeing unused kernel memory: 260k freed
INIT: version 2.78 booting
		Welcome to Red Hat Linux Advanced Server
		Press 'I' to enter interactive startup.
Mounting proc filesystem:  [  OK  ]
Unmounting initrd:  [  OK  ]
Configuring kernel parameters:  [  OK  ]
Setting clock  (utc): Tue Jan 28 18:10:13 EST 2003 [  OK  ]
Activating swap partitions:  [  OK  ]
Setting hostname test-p2:  [  OK  ]
Your system appears to have shut down uncleanly
Press Y within 1 seconds to force file system integrity check...
Checking root filesystem
/dev/sda1 is mounted.  e2fsck: Cannot continue, aborting.


[/sbin/fsck.ext3 (1) -- /] fsck.ext3 -a /dev/sda1 
[FAILED]

*** An error occurred during the file system check.
*** Dropping you to a shell; the system will reboot
*** when you leave the shell.
Give root password for maintenance
(or type Control-D for normal startup): 


Below is a simple fix that reorders the tests in orphan_cleanup. It
works on 2.4.9-e.10 and 2.4.18-19. A very similar patch should work on 
2.5.59.


--- linux-as/fs/ext3/super.c.orig	Wed Jan 29 08:53:59 2003
+++ linux-as/fs/ext3/super.c	Wed Jan 29 08:57:51 2003
@@ -815,12 +815,6 @@
 		return;
 	}
 
-	if (s_flags & MS_RDONLY) {
-		printk(KERN_INFO "EXT3-fs: %s: orphan cleanup on readonly fs\n",
-		       bdevname(sb->s_dev));
-		sb->s_flags &= ~MS_RDONLY;
-	}
-
 	if (sb->u.ext3_sb.s_mount_state & EXT3_ERROR_FS) {
 		if (es->s_last_orphan)
 			jbd_debug(1, "Errors on filesystem, "
@@ -830,6 +824,12 @@
 		return;
 	}
 
+	if (s_flags & MS_RDONLY) {
+		printk(KERN_INFO "EXT3-fs: %s: orphan cleanup on readonly fs\n",
+		       bdevname(sb->s_dev));
+		sb->s_flags &= ~MS_RDONLY;
+	}
+	
 	while (es->s_last_orphan) {
 		struct inode *inode;
 

Thanks,

Phil


-- 
Philip R. Auld, Ph.D.                  Technical Staff 
Egenera Corp.                        pauld@egenera.com
165 Forest St., Marlboro, MA 01752       (508)858-2600



_______________________________________________

Ext3-users@redhat.com
https://listman.redhat.com/mailman/listinfo/ext3-users

[Index of Archives]         [Linux RAID]     [Kernel Development]     [Red Hat Install]     [Video 4 Linux]     [Postgresql]     [Fedora]     [Gimp]     [Yosemite News]

  Powered by Linux