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

[e2fsprogs-1.24] "fsck -A -a" fails on reboot



Dear Ted,

I upgraded e2fsprogs and util-linux to the latest versions, as per the
instructions on the "ext3 for 2.4" page, to make the switching between
ext2-only and ext3-enabled kernels seamless.

Now that if the filesystems have not been unmounted cleanly, due to a
power failure for example, "fsck -A -a" cannot continue after checking
the root filesystem on reboot, issuing the error msg
    "/dev/???? is mounted, e2fsck: Cannot continue, aborting."

The problem is that e2fsck in e2fsck-1.24 no longer takes into account
whether /etc/mtab is writable or not; whenever it finds an mounted entry
in /etc/mtab (/proc not mounted yet at this time), it assumes it's
already mounted, even though the system has just experienced a crash. I
think the mtab checking code in older version of e2fsck is still needed:


--- e2fsprogs-1.24/e2fsck/unix.c-1.24	Wed Aug 29 08:40:27 2001
+++ e2fsprogs-1.24/e2fsck/unix.c	Wed Sep  5 10:41:27 2001
@@ -223,6 +223,20 @@
 	     (mount_flags & EXT2_MF_READONLY)))
 		return;
 
+#if (defined(__linux__) && defined(HAVE_MNTENT_H))
+        /*
+         * If the root is mounted read-only, then /etc/mtab is
+         * probably not correct; so we won't issue a warning based on
+         * it.
+         */
+        fd = open(MOUNTED, O_RDWR);
+        if (fd < 0) {
+                if (errno == EROFS)
+                        return;
+        } else
+                close(fd);
+#endif
+
 	if (ctx->options & E2F_OPT_READONLY) {
 		printf(_("Warning!  %s is mounted.\n"), ctx->filesystem_name);
 		return;

-- 
Wenzhuo





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