File locking problems?

Richard Gooch (rgooch@atnf.CSIRO.AU)
Mon, 3 Nov 1997 18:20:44 +1100


Hi, all. I've had persistant problems with filesystems not being
properly unmounted at shutdown. I've tracked it down to a corrupted
/etc/mtab. Further fiddling has shown that the corruption is most
likely to occur when I shut down the autofs-based automounter. I have
13 automounter maps, so when a killall is done on the automounter
there is a brief flurry of activity.
I've had these problems with 2.0.3x as well as 2.1.61, although I've
been doing my testing on 2.1.61.

I have been studying the code for mount 2.7f, which is supposed to
lock the /etc/mtab file before modifications. This locking is clearly
not working; however the locking code looks like it should do the
right thing. I have even prevented the /etc/mtab~ lockfile from ever
being removed, and the corruption of /etc/mtab still happens.

These tests suggest that the fcntl(2) locking system is not working
properly. Before I contemplate diving into the kernel code, is there
anyone else out there who has experienced problems with fcntl(2), or
knows about some bug? Alternatively, is there someone who knows of
some subtle bug in the mount programme itself which I've overlooked?

This problem is a real pain because I have a few large filesystems
which are needlessly checked whenever I boot.

Regards,

Richard....