Re: minor patch for 2.1.111 fs/open.c

Richard Gooch (Richard.Gooch@atnf.CSIRO.AU)
Wed, 29 Jul 1998 15:11:56 +1000

Bill Hawes writes:
> Richard Gooch wrote:
> > Could this possibly be related to an ongoing problem I've observed
> > with corrupted /etc/mtab files? As you know, mount(8) creates
> > /etc/mtab~ with O_EXCL for locking purposes. I have noticed for a long
> > time now that sometimes (say when stopping automount daemons) that
> > /etc/mtab gets corrupted. I've looked at the mount(8) code and it
> > appears to be doing the correct thing. It may be that there is a race
> > condition with open(2) and O_EXCL (I have an SMP machine).
> I think the stale dentry problem would be very rare, as it requires a failed
> open and a dput() that blocks long enough for some other task to try to walk
> the inuse filps list.
> OTOH, checking to remount r/o is one of the cases that has to use the inuse
> filps list, and this could be related to something with /etc/mtab.

No, no. Remounting r/o is *not* the problem here. I can reproduce the
problem if I just kill all my automount daemons, without bothering to
shut down the system. From the corrupted /etc/mtab contents, it
appears that multiple instances of mount(8) (called by automount(8)
when it shuts down) are writing to /etc/mtab at the same time. So the
/etc/mtab~ O_EXCL locking is not working.



To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at