Re: File locking problems?

thospel@mail.dma.be
3 Nov 1997 22:01:32 -0000


In article <199711031434.PAA02430@cave.bitwizard.nl>,
R.E.Wolff@bitwizard.nl (Rogier Wolff) writes:
> Bill Hawes wrote:
>>
>> Richard Gooch wrote:
>> >
>> > 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.
>>
>> Hi Richard,
>>
>> Have you considered doing unmounting based on /proc rather than
>> /etc/mtab? It seems to me that /etc/mtab is outdated, and that
>> unmounting should based on the kernel's view of what is currently
>> mounted.
>
> Besides that your remark is entirely correct, I'd say that if this
> uncovers a bug with locking, it deserves getting fixed.
>
> I mean that even if it is outdated to use a mount that keeps the
> currently mounted filesystems in /etc/mtab, the locking should still
> work....
>
> Roger.
>

There also seems to be a problem with the nfs daemons inheriting
filedescriptors from the program that causes them to be started.
I don't know if this problem will also exist with autofs, never used it.

I run amd which opens a logfile (for me /var/adm/amd, which in reality lives
in my /.home partition). The nfs daemons inherit this file descriptor (easy to
see in their /proc entries in the recent kernels), and when at shutdown time
the processes get killed, amd stops and closes the file descriptor, but
the nfs damons stay around (they seem unkillable) with /var/adm/amd open,
so /.home cannot be unmounted -> big filesystem check at the next boot.

For the moment I solved it by letting amd write to a fifo, and copying
the fifo to /var/adm/amd, but the right solution is to close all filedescriptors
when the kernel daemons start up

Ton
.