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

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

On Fri, Sep 07, 2001 at 07:01:35AM +0800, Wenzhuo Zhang wrote:
> On Wed, Sep 05, 2001 at 12:03:17PM -0600, Andreas Dilger wrote:
> > On Sep 05, 2001  11:57 +0800, Wenzhuo Zhang wrote:
> > > 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:

This check is happening in lib/ext2fs/ismounted.c, so the code in
e2fsck is duplicated (which is why I removed it)

	 * Check to see if we're referring to the root filesystem.
	 * If so, do a manual check to see if we can open TEST_FILE
	 * read/write, since if the root is mounted read/only, the
	 * contents of /etc/mtab may not be accurate.
	if (!strcmp(mnt->mnt_dir, "/")) {
#define TEST_FILE "/.ismount-test-file"		
		*mount_flags |= EXT2_MF_ISROOT;
		fd = open(TEST_FILE, O_RDWR|O_CREAT);
		if (fd < 0) {
			if (errno == EROFS)
				*mount_flags |= EXT2_MF_READONLY;
		} else
		(void) unlink(TEST_FILE);

> > 
> > Mount /proc before checking your non-root filesystems, and it will work.
> > 
> It is a slackware box. Slackware doesnt mount /proc first, as redhat do.
> This caused the problem, since newer versions of e2fsck changed its
> assumption of /etc/mtab.

That shouldn't be a problem, because we fall back to checking
/etc/mtab if /proc/mounts isn't available.  So the right thing should
happen if /proc isn't mounted.

However, there *is* a problem if /etc/mtab is a symlink to
/proc/mounts, and /proc/mounts isn't available.  In this case e2fsck
should print an error about bail (as tst_ismounted does).

So I've unmounted /proc, mounted my root filesystem read-only, and I
still can't reproduce your problem, it works just fine for me....

						- Ted

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