Re: minor patch for 2.1.111 fs/open.c

Richard Gooch (Richard.Gooch@atnf.CSIRO.AU)
Wed, 29 Jul 1998 12:17:08 +1000

Bill Hawes writes:
> In reviewing the usage of inuse filps I found a minor race problem in
> do_open. Following an open failure the dentry is dput(), but the
> filp->f_dentry field needs to be cleared first. If this is not done, a
> block in dput() may allow the filp to be observed with a stale dentry
> pointer, and an attempt to dereference it could be a problem.

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).

Whatever the bug is, it's really annoying, as many times when I reboot
I end up doing fsck, which is not fun when you have a lot of disc :-(
Note that I have about 13 automount daemons running, so if there is a
race condition I'm more likely to hit it than someone with just one or



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