Skip to contentSkip to conversation

Unable to mount with autofs-4.1.4: aquire_lock: can't lock lock file timed out: /var/lock/autofs

DISCUSSION Rainer Krienke 5 participants 18 messages Oct 18, 2005 – Oct 24, 2005 1 message not in the archive Kernel automounter

lore
Share & tools
lore
#0 lore raw

Hello,

using the autofs package from suse10.0 (autofs-4.1.4-6.i586.rpm; autofs4
kernel module, Kernel2.6.13-15) NFS mounts of user directories fail when using indirect mounts. The problem can be reproduced in a certrain setup describes below. Because of this, the description is a bit lenghty.

The maps for automount are taken from NIS. To mount a users directory via NFS eg. /home/krienke on a client entries from the NIS-maps auto.home and auto.vol are used. auto.master is configured like this:

/home auto.home -intr
/import auto.vol -intr

In auto.home there is this entry for each user like "krienke":

krienke localhost:/import/user2/krienke

In auto.vol you find another entry to handle the "user2" key starting at /import from above (there are more than one nfsservers exporting user1, user2, ... each with about 2000 users):

user2 nfssrv2:/export/user2

nfssrv2 ist one of our NFS servers for home directories. So basically we nfs mount a volume containing all the users on this server on /import/user2 on the client and then we mount /home/krienke on /import/user2/krienke on the client (the advantage of this indirect 2 layer mount is that we avoid problems with too many mounts for users on one client since bind mounts are used for the users home). This mount was (up to 9.3) automatically mounted as a bind mount by automount. Up to suse9.3 (using autofs4-4.1.3) this worked without problems and if I replace the suse10 autofs rpm by the suse9.3 autofs4 rpm it again does work. I can also manually issue the mount command logged by automunt
below (mount -t nfs -s -o intr nfssrv2:/export/user2 /import/user2) and it works without any problems.

When trying to mount a user like "krienke" saying eg ls ~krienke the following log appears in /var/log/messages (autmount is running with -d -v):

Oct 18 12:41:59 rzinstal1 automount[16770]: handle_packet: type = 0 
Oct 18 12:41:59 rzinstal1 automount[16770]: handle_packet_missing: token 49, name krienke 
Oct 18 12:41:59 rzinstal1 automount[16770]: attempting to mount entry /home/krienke 
Oct 18 12:41:59 rzinstal1 automount[16791]: lookup(yp): looking up krienke 
Oct 18 12:41:59 rzinstal1 automount[16791]: ret = 1 
Oct 18 12:41:59 rzinstal1 automount[16791]: lookup(yp): krienke -> localhost:/import/user2/krienke 
Oct 18 12:41:59 rzinstal1 automount[16791]: parse(sun): expanded entry: localhost:/import/user2/krienke 
Oct 18 12:41:59 rzinstal1 automount[16791]: parse(sun): gathered options: intr 
Oct 18 12:41:59 rzinstal1 automount[16791]: parse(sun): dequote("localhost:/import/user2/krienke") -> localhost:/import/user2/krienke 
Oct 18 12:41:59 rzinstal1 automount[16791]: parse(sun): core of entry: options=intr, loc=localhost:/import/user2/krienke 
Oct 18 12:41:59 rzinstal1 automount[16791]: parse(sun): mounting root /home, mountpoint krienke, what localhost:/import/user2/krienke, fstype nfs, 
Oct 18 12:41:59 rzinstal1 automount[16791]: mount(nfs): root=/home name=krienke what=localhost:/import/user2/krienke, fstype=nfs, options=intr 
Oct 18 12:41:59 rzinstal1 automount[16791]: mount(nfs): nfs options="intr", nosymlink=0, ro=0 
Oct 18 12:41:59 rzinstal1 automount[16791]: mount(nfs): winner = localhost local = 1 
Oct 18 12:41:59 rzinstal1 automount[16791]: mount(nfs): from localhost:/import/user2/krienke elected /import/user2/krienke 
Oct 18 12:41:59 rzinstal1 automount[16791]: mount(nfs): krienke is local, doing bind 
Oct 18 12:41:59 rzinstal1 automount[16791]: mount(bind): calling mkdir_path /home/krienke 
Oct 18 12:41:59 rzinstal1 automount[16791]: mount(bind): calling mount --bind -s  -o defaults /import/user2/krienke /home/krienke 
Oct 18 12:41:59 rzinstal1 automount[16772]: handle_packet: type = 0 
Oct 18 12:41:59 rzinstal1 automount[16772]: handle_packet_missing: token 50, name user2 
Oct 18 12:41:59 rzinstal1 automount[16772]: attempting to mount entry /import/user2 
Oct 18 12:41:59 rzinstal1 automount[16793]: lookup(yp): looking up user2 
Oct 18 12:41:59 rzinstal1 automount[16793]: ret = 1 
Oct 18 12:41:59 rzinstal1 automount[16793]: lookup(yp): user2 -> nfssrv2:/export/user2 
Oct 18 12:41:59 rzinstal1 automount[16793]: parse(sun): expanded entry: nfssrv2:/export/user2 
Oct 18 12:41:59 rzinstal1 automount[16793]: parse(sun): gathered options: intr 
Oct 18 12:41:59 rzinstal1 automount[16793]: parse(sun): dequote("nfssrv2:/export/user2") -> nfssrv2:/export/user2 
Oct 18 12:41:59 rzinstal1 automount[16793]: parse(sun): core of entry: options=intr, loc=nfssrv2:/export/user2 
Oct 18 12:41:59 rzinstal1 automount[16793]: parse(sun): mounting root /import, mountpoint user2, what nfssrv2:/export/user2, fstype nfs, options intr 
Oct 18 12:41:59 rzinstal1 automount[16793]: mount(nfs): root=/import name=user2 what=nfssrv2:/export/user2, fstype=nfs, options=intr 
Oct 18 12:41:59 rzinstal1 automount[16793]: mount(nfs): nfs options="intr", nosymlink=0, ro=0 
Oct 18 12:41:59 rzinstal1 automount[16793]: mount(nfs): winner = nfssrv2 local = 0 
Oct 18 12:41:59 rzinstal1 automount[16793]: mount(nfs): from nfssrv2:/export/user2 elected nfssrv2:/export/user2 
Oct 18 12:41:59 rzinstal1 automount[16793]: mount(nfs): calling mkdir_path /import/user2 
Oct 18 12:41:59 rzinstal1 automount[16793]: mount(nfs): calling mount -t nfs -s  -o intr nfssrv2:/export/user2 /import/user2 
Oct 18 12:42:30 rzinstal1 automount[16793]: aquire_lock: can't lock lock file timed out: /var/lock/autofs 
Oct 18 12:42:30 rzinstal1 automount[16793]: mount(nfs): nfs: mount failure nfssrv2:/export/user2 on /import/user2 
Oct 18 12:42:30 rzinstal1 automount[16793]: failed to mount /import/user2 
Oct 18 12:42:30 rzinstal1 automount[16793]: umount_multi: path=/import/user2 incl=1 
Oct 18 12:42:30 rzinstal1 automount[16793]: umount_multi: no mounts found under /import/user2 
Oct 18 12:42:30 rzinstal1 automount[16772]: handle_child: got pid 16793, sig 0 (0), stat 1 
Oct 18 12:42:30 rzinstal1 automount[16772]: sig_child: found pending iop pid 16793: signalled 0 (sig 0), exit status 1 
Oct 18 12:42:30 rzinstal1 automount[16772]: send_fail: token=50 

Then after 2 more retries to mount /import/user2 the whole mount fails.

Oct 18 12:44:04 rzinstal1 automount[16798]: aquire_lock: can't lock lock file timed out: /var/lock/autofs 
Oct 18 12:44:04 rzinstal1 automount[16798]: mount(nfs): nfs: mount failure nfssrv2:/export/user2 on /import/user2 
Oct 18 12:44:04 rzinstal1 automount[16798]: failed to mount /import/user2 
Oct 18 12:44:04 rzinstal1 automount[16798]: umount_multi: path=/import/user2 incl=1 
Oct 18 12:44:04 rzinstal1 automount[16798]: umount_multi: no mounts found under /import/user2 
Oct 18 12:44:04 rzinstal1 automount[16772]: handle_child: got pid 16798, sig 0 (0), stat 1 
Oct 18 12:44:04 rzinstal1 automount[16772]: sig_child: found pending iop pid 16798: signalled 0 (sig 0), exit status 1 
Oct 18 12:44:04 rzinstal1 automount[16772]: send_fail: token=54 
Oct 18 12:44:04 rzinstal1 automount[16795]: >> mount: special device /import/user2/krienke does not exist 
Oct 18 12:44:04 rzinstal1 automount[16795]: failed to mount /home/krienke 
Oct 18 12:44:04 rzinstal1 automount[16795]: umount_multi: path=/home/krienke incl=1 
Oct 18 12:44:04 rzinstal1 automount[16795]: umount_multi: no mounts found under /home/krienke 
Oct 18 12:44:04 rzinstal1 automount[16770]: handle_child: got pid 16795, sig 0 (0), stat 1 
Oct 18 12:44:04 rzinstal1 automount[16770]: sig_child: found pending iop pid 16795: signalled 0 (sig 0), exit status 1 
Oct 18 12:44:04 rzinstal1 automount[16770]: send_fail: token=52 

Any idea why or how to fix this?

Thanks
Rainer

Signature · 6 lines
---------------------------------------------------------------------------
Rainer Krienke, Universitaet Koblenz, Rechenzentrum, Raum A022
Universitaetsstrasse 1, 56070 Koblenz, Tel: +49 261287 -1312, Fax: -1001312
Mail: [email protected], Web: http://www.uni-koblenz.de/~krienke
Get my public PGP key: http://www.uni-koblenz.de/~krienke/mypgp.html
---------------------------------------------------------------------------
#1 lore raw
Quoted 11 lines · Rainer Krienke

using the autofs package from suse10.0 (autofs-4.1.4-6.i586.rpm; autofs4 kernel module, Kernel2.6.13-15) NFS mounts of user directories fail ... In auto.home there is this entry for each user like "krienke":

krienke localhost:/import/user2/krienke

In auto.vol you find another entry to handle the "user2" key starting at /import from above (there are more than one nfsservers exporting user1, user2, ... each with about 2000 users):

user2 nfssrv2:/export/user2

Oct 18 12:42:30 rzinstal1 automount[16793]: aquire_lock: can't lock lock file timed out: /var/lock/autofs 

Now that's a very neat solution to the problem of too many incoming / outgoing mounts. But unfortunately you're doing the following sequence:

User refers to /home/krienke
Autofs starts to mount /import/homesite/fsys/krienke, stats
/import/homesite/fsys
Second autofs thread starts to mount homesite:/export/fsys
Oops, an autofs thread has the lock, 2nd thread either blocks waiting for the lock, or dies. (The latter, judging from timestamps.)

The ideal is for autofs to avoid the deadlock by itself, but for a quick fix I'd put a programmatic map on /home which would do the NIS lookup by itself to ascertain which is the home site, would pre-mount /import/homesite/filesys (using the automounter, by statting the filesystem root), then would emit a map row pointing to the actual homedir.

I've attached my auto.net programmatic map. Our issues are different from yours, but some of the issues are similar enough that portions of the program could be copied.

James F. Carter Voice 310 825 2897 FAX 310 206 6673
UCLA-Mathnet; 6115 MSA; 405 Hilgard Ave.; Los Angeles, CA, USA 90095-1555
Email: [email protected] http://www.math.ucla.edu/~jimc (q.v. for PGP key)

#!/bin/sh
# Equivalent of the "hosts" map on Sun's automounter.
# Copyright (c) 2001 by The Regents of the University of California # Author: Jim Carter, UCLA-Mathnet <[email protected]>, 2001-08-23

# This is an executable map file, mounted on /net. When the automounter

# sees /net/$host/restof/path, it runs this script with $1 = hostname.
# This program does automagical setup, then emits a map line directing
# attention to /rete/$host, on which it has mounted a separate automount
# process which takes it from there.  Since the referent is on the local
# host, the /net automounter emits a symbolic link or does a "bind" mount,
# which is efficient.

# Specify -d for debug mode.
if [ X$1 != X-d ] ; then
# If you want to customize the name of the secondary mount directory
rete=/rete
# Minimum time in minutes between purging unused host processes
purgetime=60
# autobase is the basename of the automount program
autobase=automount
else

    shift
    opt_d=DEBUG
    rete=./rete
    purgetime=1
    autobase=sleep

fi

# Idiotproof for testing
if [ -z "$1" ] ; then
echo "Usage: $0 hostname (hostname required)" 1>&2
fi

# Purge unused host-specific map files. This occurs # at most once an hour.
# find: -mmin is true if the file's mtime is N minutes old.
stamp=find $rete/TIMESTAMP -mmin -$purgetime -print 2> /dev/null if [ -z "$stamp" ] ; then

	mkdir $rete/KEEP
	for f in /net/* ; do
	    bn=`basename $f`
	    if [ -f "$rete/$bn" ] ; then mv "$rete/$bn" $rete/KEEP ; fi
	done
	rm -f $rete/[a-z]*
	mv $rete/KEEP/* $rete 2> /dev/null
	rmdir $rete/KEEP
    date "+host map files last purged at %Y-%m-%d %H:%M:%S" > $rete/TIMESTAMP

fi

# Create map file for the host-specific automount process.
echo "* $1:/&" > $rete/$1

# Emit map row to cause an autofs submount to be spawned. # Resulting command line is:
# /usr/sbin/automount --submount /net/$1 file $rete/$1 # followed by map options if any were specified.
echo "-rsize=8192,wsize=8192,retry=1,soft,fstype=autofs file:$rete/$1"
exit 0

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs

#2 lore raw
Quoted 18 lines · you
Quoted 6 lines · Rainer Krienke

using the autofs package from suse10.0 (autofs-4.1.4-6.i586.rpm; autofs4 kernel module, Kernel2.6.13-15) NFS mounts of user directories fail ... In auto.home there is this entry for each user like "krienke":

krienke localhost:/import/user2/krienke

Quoted 7 lines

In auto.vol you find another entry to handle the "user2" key starting at /import from above (there are more than one nfsservers exporting user1, user2, ... each with about 2000 users):

user2 nfssrv2:/export/user2

Oct 18 12:42:30 rzinstal1 automount[16793]: aquire_lock: can't lock lock

file timed out: /var/lock/autofs

Now that's a very neat solution to the problem of too many incoming / outgoing mounts. But unfortunately you're doing the following sequence:

Quoted 8 lines

User refers to /home/krienke
Autofs starts to mount /import/homesite/fsys/krienke, stats
/import/homesite/fsys
Second autofs thread starts to mount homesite:/export/fsys
Oops, an autofs thread has the lock, 2nd thread either blocks waiting for the lock, or dies. (The latter, judging from timestamps.)

Thanks for the answer but I am not sure if this is the point, simply because this setup works an all other (older) machines eg with autofs 4.1.3. So it seems autofs had the capabilities to to hierachical mounts already but seems to have lost it in its current release.

Have a nice day
Rainer

Signature · 6 lines
---------------------------------------------------------------------------
Rainer Krienke, Universitaet Koblenz, Rechenzentrum, Raum A022
Universitaetsstrasse 1, 56070 Koblenz, Tel: +49 261287 -1312, Fax: -1001312
Mail: [email protected], Web: http://www.uni-koblenz.de/~krienke
Get my public PGP key: http://www.uni-koblenz.de/~krienke/mypgp.html
---------------------------------------------------------------------------
#3 lore raw

==> Regarding Re: [autofs] Unable to mount with autofs-4.1.4: aquire_lock: can't lock lock file timed out: /var/lock/autofs; Rainer Krienke <[email protected]> adds:

Quoted 18 lines · you
Quoted 18 lines

On Tue, 18 Oct 2005, Rainer Krienke wrote: > using the autofs package from suse10.0 (autofs-4.1.4-6.i586.rpm; autofs4 > kernel module, Kernel2.6.13-15) NFS mounts of user directories fail ... > In auto.home there is this entry for each user like "krienke":

Quoted 4 lines

krienke localhost:/import/user2/krienke

In auto.vol you find another entry to handle the "user2" key starting

at > /import from above (there are more than one nfsservers exporting user1, > user2, ... each with about 2000 users):

Quoted 2 lines

user2 nfssrv2:/export/user2 > Oct 18 12:42:30 rzinstal1

automount[16793]: aquire_lock: can't lock lock > file timed out:
/var/lock/autofs

Now that's a very neat solution to the problem of too many incoming / outgoing mounts. But unfortunately you're doing the following sequence:

Quoted 6 lines
Quoted 6 lines

User refers to /home/krienke Autofs starts to mount /import/homesite/fsys/krienke, stats /import/homesite/fsys Second autofs thread starts to mount homesite:/export/fsys Oops, an autofs thread has the lock, 2nd thread either blocks waiting for the lock, or dies. (The latter, judging from timestamps.)

krienke> Thanks for the answer but I am not sure if this is the point, krienke> simply because this setup works an all other (older) machines eg krienke> with autofs 4.1.3. So it seems autofs had the capabilities to to krienke> hierachical mounts already but seems to have lost it in its krienke> current release.

Well, it worked before, but not by design. The autofs lock was a "best effort" thing in 4.1.3 and before. If we didn't obtain the lock within a certain amount of time, we would reset the lock, and then take it.

I'll defer to Ian for whether we want to support what you are doing. In the past, it's my recollection that he said hierarchical mounts simply aren't supported.

-Jeff

maintainer
#4 lore raw
In reply to Rainer Krienke
Quoted 6 lines · Rainer Krienke

Hello,

using the autofs package from suse10.0 (autofs-4.1.4-6.i586.rpm; autofs4
kernel module, Kernel2.6.13-15) NFS mounts of user directories fail when using indirect mounts. The problem can be reproduced in a certrain setup describes below. Because of this, the description is a bit lenghty.

It's good to see that SuSE is attempting to keep up with the autofs versions. If you have the oppertunity, Rainer, please thank them for me.

Quoted 17 lines

The maps for automount are taken from NIS. To mount a users directory via NFS eg. /home/krienke on a client entries from the NIS-maps auto.home and auto.vol are used. auto.master is configured like this:

/home auto.home -intr
/import auto.vol -intr

In auto.home there is this entry for each user like "krienke":

krienke localhost:/import/user2/krienke

In auto.vol you find another entry to handle the "user2" key starting at /import from above (there are more than one nfsservers exporting user1, user2, ... each with about 2000 users):

user2 nfssrv2:/export/user2

Quoted 9 lines

nfssrv2 ist one of our NFS servers for home directories. So basically we nfs mount a volume containing all the users on this server on /import/user2 on the client and then we mount /home/krienke on /import/user2/krienke on the client (the advantage of this indirect 2 layer mount is that we avoid problems with too many mounts for users on one client since bind mounts are used for the users home). This mount was (up to 9.3) automatically mounted as a bind mount by automount. Up to suse9.3 (using autofs4-4.1.3) this worked without problems and if I replace the suse10 autofs rpm by the suse9.3 autofs4 rpm it again does work. I can also manually issue the mount command logged by automunt
below (mount -t nfs -s -o intr nfssrv2:/export/user2 /import/user2) and it works without any problems.

As Jeff has said this sort of nesting of mounts is, in general, not supported by autofs and it worked previously because the locking was less broken in 4.1.3 than in 4.1.4 (yes its still broken in 4.1.4).

Can this case be done safely?

I'm not entirely sure of the answer to this but I've never liked using locking in autofs. I introduced it only to prevent mtab corruption during mount (correct me if you have a different recollection Jeff). It happens during rapid mount activity such as when there as a largish number of entries in the master map (of the order of 50 or more).

The mtab locking should be done in mount which narrows the scope of the lock enough to allow this case to function as requested.

However, lets not forget that, even if mount were working OK today, we would need to carry a patch in the autofs distribution for older versions. I can see the mailing list filling with support queries already.

Can we eliminate the locking without reintroducing the problems that lead to it being used?

Maybe, if mounts locking is working as intended but see above.

Can this be done another way?

Probably with a multi-mount map but this would introduce a fair bit of added complexity to the map. Or possibly with a program map as Jim has suggested.

Quoted 84 lines

When trying to mount a user like "krienke" saying eg ls ~krienke the following log appears in /var/log/messages (autmount is running with -d -v):

Oct 18 12:41:59 rzinstal1 automount[16770]: handle_packet: type = 0 
Oct 18 12:41:59 rzinstal1 automount[16770]: handle_packet_missing: token 49, name krienke 
Oct 18 12:41:59 rzinstal1 automount[16770]: attempting to mount entry /home/krienke 
Oct 18 12:41:59 rzinstal1 automount[16791]: lookup(yp): looking up krienke 
Oct 18 12:41:59 rzinstal1 automount[16791]: ret = 1 
Oct 18 12:41:59 rzinstal1 automount[16791]: lookup(yp): krienke -> localhost:/import/user2/krienke 
Oct 18 12:41:59 rzinstal1 automount[16791]: parse(sun): expanded entry: localhost:/import/user2/krienke 
Oct 18 12:41:59 rzinstal1 automount[16791]: parse(sun): gathered options: intr 
Oct 18 12:41:59 rzinstal1 automount[16791]: parse(sun): dequote("localhost:/import/user2/krienke") -> localhost:/import/user2/krienke 
Oct 18 12:41:59 rzinstal1 automount[16791]: parse(sun): core of entry: options=intr, loc=localhost:/import/user2/krienke 
Oct 18 12:41:59 rzinstal1 automount[16791]: parse(sun): mounting root /home, mountpoint krienke, what localhost:/import/user2/krienke, fstype nfs, 
Oct 18 12:41:59 rzinstal1 automount[16791]: mount(nfs): root=/home name=krienke what=localhost:/import/user2/krienke, fstype=nfs, options=intr 
Oct 18 12:41:59 rzinstal1 automount[16791]: mount(nfs): nfs options="intr", nosymlink=0, ro=0 
Oct 18 12:41:59 rzinstal1 automount[16791]: mount(nfs): winner = localhost local = 1 
Oct 18 12:41:59 rzinstal1 automount[16791]: mount(nfs): from localhost:/import/user2/krienke elected /import/user2/krienke 
Oct 18 12:41:59 rzinstal1 automount[16791]: mount(nfs): krienke is local, doing bind 
Oct 18 12:41:59 rzinstal1 automount[16791]: mount(bind): calling mkdir_path /home/krienke 
Oct 18 12:41:59 rzinstal1 automount[16791]: mount(bind): calling mount --bind -s  -o defaults /import/user2/krienke /home/krienke 
Oct 18 12:41:59 rzinstal1 automount[16772]: handle_packet: type = 0 
Oct 18 12:41:59 rzinstal1 automount[16772]: handle_packet_missing: token 50, name user2 
Oct 18 12:41:59 rzinstal1 automount[16772]: attempting to mount entry /import/user2 
Oct 18 12:41:59 rzinstal1 automount[16793]: lookup(yp): looking up user2 
Oct 18 12:41:59 rzinstal1 automount[16793]: ret = 1 
Oct 18 12:41:59 rzinstal1 automount[16793]: lookup(yp): user2 -> nfssrv2:/export/user2 
Oct 18 12:41:59 rzinstal1 automount[16793]: parse(sun): expanded entry: nfssrv2:/export/user2 
Oct 18 12:41:59 rzinstal1 automount[16793]: parse(sun): gathered options: intr 
Oct 18 12:41:59 rzinstal1 automount[16793]: parse(sun): dequote("nfssrv2:/export/user2") -> nfssrv2:/export/user2 
Oct 18 12:41:59 rzinstal1 automount[16793]: parse(sun): core of entry: options=intr, loc=nfssrv2:/export/user2 
Oct 18 12:41:59 rzinstal1 automount[16793]: parse(sun): mounting root /import, mountpoint user2, what nfssrv2:/export/user2, fstype nfs, options intr 
Oct 18 12:41:59 rzinstal1 automount[16793]: mount(nfs): root=/import name=user2 what=nfssrv2:/export/user2, fstype=nfs, options=intr 
Oct 18 12:41:59 rzinstal1 automount[16793]: mount(nfs): nfs options="intr", nosymlink=0, ro=0 
Oct 18 12:41:59 rzinstal1 automount[16793]: mount(nfs): winner = nfssrv2 local = 0 
Oct 18 12:41:59 rzinstal1 automount[16793]: mount(nfs): from nfssrv2:/export/user2 elected nfssrv2:/export/user2 
Oct 18 12:41:59 rzinstal1 automount[16793]: mount(nfs): calling mkdir_path /import/user2 
Oct 18 12:41:59 rzinstal1 automount[16793]: mount(nfs): calling mount -t nfs -s  -o intr nfssrv2:/export/user2 /import/user2 
Oct 18 12:42:30 rzinstal1 automount[16793]: aquire_lock: can't lock lock file timed out: /var/lock/autofs 
Oct 18 12:42:30 rzinstal1 automount[16793]: mount(nfs): nfs: mount failure nfssrv2:/export/user2 on /import/user2 
Oct 18 12:42:30 rzinstal1 automount[16793]: failed to mount /import/user2 
Oct 18 12:42:30 rzinstal1 automount[16793]: umount_multi: path=/import/user2 incl=1 
Oct 18 12:42:30 rzinstal1 automount[16793]: umount_multi: no mounts found under /import/user2 
Oct 18 12:42:30 rzinstal1 automount[16772]: handle_child: got pid 16793, sig 0 (0), stat 1 
Oct 18 12:42:30 rzinstal1 automount[16772]: sig_child: found pending iop pid 16793: signalled 0 (sig 0), exit status 1 
Oct 18 12:42:30 rzinstal1 automount[16772]: send_fail: token=50 

Then after 2 more retries to mount /import/user2 the whole mount fails.

Oct 18 12:44:04 rzinstal1 automount[16798]: aquire_lock: can't lock lock file timed out: /var/lock/autofs 
Oct 18 12:44:04 rzinstal1 automount[16798]: mount(nfs): nfs: mount failure nfssrv2:/export/user2 on /import/user2 
Oct 18 12:44:04 rzinstal1 automount[16798]: failed to mount /import/user2 
Oct 18 12:44:04 rzinstal1 automount[16798]: umount_multi: path=/import/user2 incl=1 
Oct 18 12:44:04 rzinstal1 automount[16798]: umount_multi: no mounts found under /import/user2 
Oct 18 12:44:04 rzinstal1 automount[16772]: handle_child: got pid 16798, sig 0 (0), stat 1 
Oct 18 12:44:04 rzinstal1 automount[16772]: sig_child: found pending iop pid 16798: signalled 0 (sig 0), exit status 1 
Oct 18 12:44:04 rzinstal1 automount[16772]: send_fail: token=54 
Oct 18 12:44:04 rzinstal1 automount[16795]: >> mount: special device /import/user2/krienke does not exist 
Oct 18 12:44:04 rzinstal1 automount[16795]: failed to mount /home/krienke 
Oct 18 12:44:04 rzinstal1 automount[16795]: umount_multi: path=/home/krienke incl=1 
Oct 18 12:44:04 rzinstal1 automount[16795]: umount_multi: no mounts found under /home/krienke 
Oct 18 12:44:04 rzinstal1 automount[16770]: handle_child: got pid 16795, sig 0 (0), stat 1 
Oct 18 12:44:04 rzinstal1 automount[16770]: sig_child: found pending iop pid 16795: signalled 0 (sig 0), exit status 1 
Oct 18 12:44:04 rzinstal1 automount[16770]: send_fail: token=52 

Any idea why or how to fix this?

Thanks
Rainer

Signature · 11 lines
---------------------------------------------------------------------------
Rainer Krienke, Universitaet Koblenz, Rechenzentrum, Raum A022
Universitaetsstrasse 1, 56070 Koblenz, Tel: +49 261287 -1312, Fax: -1001312
Mail: [email protected], Web: http://www.uni-koblenz.de/~krienke
Get my public PGP key: http://www.uni-koblenz.de/~krienke/mypgp.html
---------------------------------------------------------------------------

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs
#5 lore raw
Quoted 6 lines · Ian Kent

As Jeff has said this sort of nesting of mounts is, in general, not supported by autofs and it worked previously because the locking was less broken in 4.1.3 than in 4.1.4 (yes its still broken in 4.1.4).

Can this case be done safely?

Quoted 9 lines

I'm not entirely sure of the answer to this but I've never liked using locking in autofs. I introduced it only to prevent mtab corruption during mount (correct me if you have a different recollection Jeff). It happens during rapid mount activity such as when there as a largish number of entries in the master map (of the order of 50 or more).

The mtab locking should be done in mount which narrows the scope of the lock enough to allow this case to function as requested.

For me it would be important to learn if this feature will be possible in the future or if it is decided that for whatever reason it will not be. The former case would be the best thing for me because I would not have to find a new solution for mounting home directories and I guess other people with a large user base would also welcome it. In the latter case I have to think about a alternative way to go for the future. At the moment my solution is to use an older version of autofs for suse10.0 installations since this older autofs version simply works for me but this is of course not an ideal solution.

Any comments?

Thanks
Rainer Krienke

Signature · 6 lines
---------------------------------------------------------------------------
Rainer Krienke, Universitaet Koblenz, Rechenzentrum, Raum A022
Universitaetsstrasse 1, 56070 Koblenz, Tel: +49 261287 -1312, Fax: -1001312
Mail: [email protected], Web: http://www.uni-koblenz.de/~krienke
Get my public PGP key: http://www.uni-koblenz.de/~krienke/mypgp.html
---------------------------------------------------------------------------

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs

maintainer
#6 lore raw
Quoted 27 lines · Rainer Krienke
Quoted 6 lines · Ian Kent

As Jeff has said this sort of nesting of mounts is, in general, not supported by autofs and it worked previously because the locking was less broken in 4.1.3 than in 4.1.4 (yes its still broken in 4.1.4).

Can this case be done safely?

Quoted 9 lines

I'm not entirely sure of the answer to this but I've never liked using locking in autofs. I introduced it only to prevent mtab corruption during mount (correct me if you have a different recollection Jeff). It happens during rapid mount activity such as when there as a largish number of entries in the master map (of the order of 50 or more).

The mtab locking should be done in mount which narrows the scope of the lock enough to allow this case to function as requested.

For me it would be important to learn if this feature will be possible in the future or if it is decided that for whatever reason it will not be. The former case would be the best thing for me because I would not have to find a new solution for mounting home directories and I guess other people with a large user base would also welcome it. In the latter case I have to think about a alternative way to go for the future. At the moment my solution is to use an older version of autofs for suse10.0 installations since this older autofs version simply works for me but this is of course not an ideal solution.

Quoted 1 line

Any comments?

Yes.

I was wondering what can be done about this also.

All that I can offer is to make a patch to remove the locking from autofs and another for mount (util-linux) to hopefully fix the mtab locking. If you are prepared to carry these non-standard patches we can see how it goes. Somewhat more testing would be required before removing the locking from the distribution.

Ian

#7 lore raw

==> Regarding Re: [autofs] Unable to mount with autofs-4.1.4: aquire_lock: can't lock lock file timed out: /var/lock/autofs; Ian Kent <[email protected]> adds:

Quoted 28 lines · Rainer Krienke
Quoted 28 lines

On Mittwoch 19 Oktober 2005 17:55, Ian Kent wrote: > As Jeff has said this sort of nesting of mounts is, in general, not > supported by autofs and it worked previously because the locking was less > broken in 4.1.3 than in 4.1.4 (yes its still broken in 4.1.4).

Quoted 5 lines

Can this case be done safely?

I'm not entirely sure of the answer to this but I've never liked using locking in autofs. I introduced it only to prevent mtab corruption

during > mount (correct me if you have a different recollection Jeff). It happens > during rapid mount activity such as when there as a largish number of > entries in the master map (of the order of 50 or more).

Quoted 2 lines

The mtab locking should be done in mount which narrows the scope of

the > lock enough to allow this case to function as requested.

Quoted 1 line

For me it would be important to learn if this feature will be possible in the future or if it is decided that for whatever reason it will not be. The former case would be the best thing for me because I would not have to find a new solution for mounting home directories and I guess other people with a large user base would also welcome it. In the latter case I have to think about a alternative way to go for the future. At the moment my solution is to use an older version of autofs for suse10.0 installations since this older autofs version simply works for me but this is of course not an ideal solution.

Quoted 1 line
Quoted 1 line

Any comments?

raven> Yes.

raven> I was wondering what can be done about this also.

raven> All that I can offer is to make a patch to remove the locking from raven> autofs and another for mount (util-linux) to hopefully fix the mtab raven> locking. If you are prepared to carry these non-standard patches we raven> can see how it goes. Somewhat more testing would be required before raven> removing the locking from the distribution.

What, exactly, do you think is broken about the mtab locking? I remember spending a few hours with that code, and it looked sane to me.

-Jeff

#8 lore raw
Quoted 37 lines

==> Regarding Re: [autofs] Unable to mount with autofs-4.1.4: aquire_lock: can't lock lock file timed out: /var/lock/autofs; Ian Kent <[email protected]> adds:

Quoted 28 lines · Rainer Krienke
Quoted 28 lines

On Mittwoch 19 Oktober 2005 17:55, Ian Kent wrote: > As Jeff has said this sort of nesting of mounts is, in general, not > supported by autofs and it worked previously because the locking was less > broken in 4.1.3 than in 4.1.4 (yes its still broken in 4.1.4).

Quoted 5 lines

Can this case be done safely?

I'm not entirely sure of the answer to this but I've never liked using locking in autofs. I introduced it only to prevent mtab corruption

during > mount (correct me if you have a different recollection Jeff). It happens > during rapid mount activity such as when there as a largish number of > entries in the master map (of the order of 50 or more).

Quoted 2 lines

The mtab locking should be done in mount which narrows the scope of

the > lock enough to allow this case to function as requested.

Quoted 1 line

For me it would be important to learn if this feature will be possible in the future or if it is decided that for whatever reason it will not be. The former case would be the best thing for me because I would not have to find a new solution for mounting home directories and I guess other people with a large user base would also welcome it. In the latter case I have to think about a alternative way to go for the future. At the moment my solution is to use an older version of autofs for suse10.0 installations since this older autofs version simply works for me but this is of course not an ideal solution.

Quoted 1 line
Quoted 1 line

Any comments?

raven> Yes.

raven> I was wondering what can be done about this also.

Quoted 8 lines

raven> All that I can offer is to make a patch to remove the locking from raven> autofs and another for mount (util-linux) to hopefully fix the mtab raven> locking. If you are prepared to carry these non-standard patches we raven> can see how it goes. Somewhat more testing would be required before raven> removing the locking from the distribution.

What, exactly, do you think is broken about the mtab locking? I remember spending a few hours with that code, and it looked sane to me.

We used to see the problem of the mtab getting corrupted due to too many filesystems getting mounted within a short time frame. We started using this patch a while ago and have continued to do so, even though autofs now has locking. The mtab problems stopped after making this change.

===============================================================================
If there are lots of mounts happening simultaneously (usually due to autofs), the locking of /etc/mtab could fail, in which case, the mount succeeds, but doesn't get properly recorded in the mount table. This patch greatly increases the number of tries to lock the mtab, before giving up. The chance that the lock will fail due to contention from lots of other mount processes should be very close to nil.

-- Joseph Moss <[email protected]> 13-Nov-2002

mount/fstab.c renamed from mount/fstab.c.waitlock +6 -2
@@ -441,8 +441,12 @@
 			alarm(0);
 			/* Limit the number of iterations - maybe there
 			   still is some old /etc/mtab~ */
-			if (tries++ > 3) {
-				if (tries > 5)
+			if (tries++ > 2) {
+				if ((tries % 20) == 0)
+				    printf(_("Warning: Unable to create link %s"
+						" after %d tries\n"),
+					   MOUNTED_LOCK, tries);
+				if (tries > 115)
 					die (EX_FILEIO, _("Cannot create link %s\n"
 					    "Perhaps there is a stale lock file?\n"),
 					     MOUNTED_LOCK);
maintainer
#9 lore raw
Quoted 29 lines · Joseph V Moss
Quoted 3 lines

What, exactly, do you think is broken about the mtab locking? I remember spending a few hours with that code, and it looked sane to me.

We used to see the problem of the mtab getting corrupted due to too many filesystems getting mounted within a short time frame. We started using this patch a while ago and have continued to do so, even though autofs now has locking. The mtab problems stopped after making this change.

===============================================================================
If there are lots of mounts happening simultaneously (usually due to autofs), the locking of /etc/mtab could fail, in which case, the mount succeeds, but doesn't get properly recorded in the mount table. This patch greatly increases the number of tries to lock the mtab, before giving up. The chance that the lock will fail due to contention from lots of other mount processes should be very close to nil.

-- Joseph Moss <[email protected]> 13-Nov-2002

mount/fstab.c renamed from mount/fstab.c.waitlock +0 -1
@@ -441,8 +441,12 @@
 			alarm(0);
 			/* Limit the number of iterations - maybe there
 			   still is some old /etc/mtab~ */
-			if (tries++ > 3) {

mount/fstab.c line 452

Quoted 10 lines
mount/fstab.c renamed from mount/fstab.c.waitlock +6 -1
-				if (tries > 5)
+			if (tries++ > 2) {
+				if ((tries % 20) == 0)
+				    printf(_("Warning: Unable to create link %s"
+						" after %d tries\n"),
+					   MOUNTED_LOCK, tries);
+				if (tries > 115)
 					die (EX_FILEIO, _("Cannot create link %s\n"
 					    "Perhaps there is a stale lock file?\n"),
 					     MOUNTED_LOCK);

Yes, I can see how that would help. I think you have identified the symptom but I may have stumbled onto the cause.

This is the mail I sent to Adrain the other day regarding this problem.

From [email protected] Sat Sep 24 17:35:46 2005
Date: Sat, 24 Sep 2005 17:32:58 +0800 (WST)
From: Ian Kent <[email protected]>
To: Adrian Bunk <[email protected]>
Subject: Re: mtab locking - who wants to talk abou this

Quoted 6 lines · Adrian Bunk
Quoted 2 lines · Ian Kent

Hi Adrian,

Hi Ian,

Quoted 8 lines
Quoted 5 lines

I'm looking for someone that is involved in maintaining util-linux.

I have been looking, on and of, for quite a while now without any success, at least I haven't found anyone willing to reply. Well that's a bit of an exaggeration. I sent mail to Andries Bouwer and got no reply.

Andries passed maintainership of util-linux to me last year, so I'm the right contact.

Cool.

I've had trouble with mtab corruption for a long time now. With rapid mounting requests from autofs.

I have not been able to see what the problem was with the locking until I had another look the other day.

I'm not sure if I'm right but hopefully another set of eyes will sort that out.

What I think is happening is, in mount/fstab.c:lock_mtab when there is a lock held and another process attempts to wait for it, it doesn't. The tries are rapidly exhausted resulting in a lock failure.

I believe the reason is because the code assumes that, when attempting to wait for the lock file a flock is held on it by the owner, which is not the case. The culprit is the position of the close, which releases any locks held by the process when called.

I made a little patch but haven't had time to test it yet. I'll have to rip out the locking I introduced to autofs to do that so it will likely be little while before I can. The close at the exit is probably not needed as the flock will also be released at process termination. I included it for completeness. I had some difficulty patching different versions of util-linux so I'm not sure it will apply cleanly to your tree. The patch is straight forward though.

Please let me know what you think.

Ian

mount/fstab.c renamed from mount/fstab.c.flock +3 -2
@@ -417,6 +417,7 @@
 unlock_mtab (void) {
 	if (we_created_lockfile) {
 		unlink (MOUNTED_LOCK);
+		close(we_created_lock_file);
 		we_created_lockfile = 0;
 	}
 }
@@ -528,6 +529,7 @@
 				}
 				/* proceed anyway */
 			}
+			we_created_lock_file = fd;
 		} else {
 			static int tries = 0;
 
@@ -549,9 +551,8 @@
 					     MOUNTED_LOCK);
 				sleep(1);
 			}
+			close(fd);
 		}
-
-		close(fd);
 	}
 }
#10 lore raw

==> Regarding Re: [autofs] Unable to mount with autofs-4.1.4: aquire_lock: can't lock lock file timed out: /var/lock/autofs ; Ian Kent <[email protected]> adds:

Quoted 19 lines · Joseph V Moss
Quoted 19 lines
Quoted 1 line
Quoted 1 line

What, exactly, do you think is broken about the mtab locking? I

remember > spending a few hours with that code, and it looked sane to me.

We used to see the problem of the mtab getting corrupted due to too many filesystems getting mounted within a short time frame. We started using this patch a while ago and have continued to do so, even though autofs now has locking. The mtab problems stopped after making this change.

===============================================================================
If there are lots of mounts happening simultaneously (usually due to autofs), the locking of /etc/mtab could fail, in which case, the mount succeeds, but doesn't get properly recorded in the mount table. This patch greatly increases the number of tries to lock the mtab, before giving up. The chance that the lock will fail due to contention from lots of other mount processes should be very close to nil.

-- Joseph Moss <[email protected]> 13-Nov-2002

Quoted 10 lines
Quoted 10 lines

--- util-linux-2.11g/mount/fstab.c.waitlock Wed Nov 13 11:45:40 2002 +++ util-linux-2.11g/mount/fstab.c Wed Nov 13 12:04:55 2002 @@ -441,8 +441,12 @@ alarm(0); /* Limit the number of iterations - maybe there still is some old /etc/mtab~ */ - if (tries++ > 3) { - if (tries > 5) + if (tries++ > 2) { + if ((tries % 20) == 0) + printf(_("Warning: Unable to create link %s" + " after %d tries\n"), + MOUNTED_LOCK, tries); + if (tries > 115) die (EX_FILEIO, _("Cannot create link %s\n" "Perhaps there is a stale lock file?\n"), MOUNTED_LOCK);

raven> Yes, I can see how that would help. I think you have identified the raven> symptom but I may have stumbled onto the cause.

raven> This is the mail I sent to Adrain the other day regarding this raven> problem.

Quoted 1 line
Quoted 1 line

From [email protected] Sat Sep 24 17:35:46 2005

raven> Date: Sat, 24 Sep 2005 17:32:58 +0800 (WST) From: Ian Kent raven> <[email protected]> To: Adrian Bunk <[email protected]> Subject: Re:
raven> mtab locking - who wants to talk abou this

Quoted 8 lines · Adrian Bunk
Quoted 8 lines · Ian Kent
Quoted 2 lines

Hi Adrian,

Hi Ian,

Quoted 2 lines

I'm looking for someone that is involved in maintaining util-linux.

Quoted 7 lines
Quoted 7 lines
Quoted 1 line

I have been looking, on and of, for quite a while now without any >

success, at least I haven't found anyone willing to reply. Well that's a

Quoted 1 line

bit of an exaggeration. I sent mail to Andries Bouwer and got no

reply.

Andries passed maintainership of util-linux to me last year, so I'm the right contact.

raven> Cool.

raven> I've had trouble with mtab corruption for a long time now. With raven> rapid mounting requests from autofs.

raven> I have not been able to see what the problem was with the locking raven> until I had another look the other day.

raven> I'm not sure if I'm right but hopefully another set of eyes will raven> sort that out.

raven> What I think is happening is, in mount/fstab.c:lock_mtab when there raven> is a lock held and another process attempts to wait for it, it raven> doesn't. The tries are rapidly exhausted resulting in a lock raven> failure.

raven> I believe the reason is because the code assumes that, when raven> attempting to wait for the lock file a flock is held on it by the raven> owner, which is not the case. The culprit is the position of the raven> close, which releases any locks held by the process when called.

raven> I made a little patch but haven't had time to test it yet. I'll have raven> to rip out the locking I introduced to autofs to do that so it will raven> likely be little while before I can. The close at the exit is raven> probably not needed as the flock will also be released at process raven> termination. I included it for completeness. I had some difficulty raven> patching different versions of util-linux so I'm not sure it will raven> apply cleanly to your tree. The patch is straight forward though.

raven> Please let me know what you think.

Funny, I sent a similar patch along several months ago! Or, at least I described the problem. At that time, I thought it would only result in us failing a little too quickly.

I'm surprised the issue hasn't been addressed yet.

-Jeff

maintainer
#11 lore raw
In reply to Jeff Moyer
Quoted 37 lines · Jeff Moyer

==> Regarding Re: [autofs] Unable to mount with autofs-4.1.4: aquire_lock: can't lock lock file timed out: /var/lock/autofs; Ian Kent <[email protected]> adds:

Quoted 28 lines · Rainer Krienke
Quoted 28 lines

On Mittwoch 19 Oktober 2005 17:55, Ian Kent wrote: > As Jeff has said this sort of nesting of mounts is, in general, not > supported by autofs and it worked previously because the locking was less > broken in 4.1.3 than in 4.1.4 (yes its still broken in 4.1.4).

Quoted 5 lines

Can this case be done safely?

I'm not entirely sure of the answer to this but I've never liked using locking in autofs. I introduced it only to prevent mtab corruption

during > mount (correct me if you have a different recollection Jeff). It happens > during rapid mount activity such as when there as a largish number of > entries in the master map (of the order of 50 or more).

Quoted 2 lines

The mtab locking should be done in mount which narrows the scope of

the > lock enough to allow this case to function as requested.

Quoted 1 line

For me it would be important to learn if this feature will be possible in the future or if it is decided that for whatever reason it will not be. The former case would be the best thing for me because I would not have to find a new solution for mounting home directories and I guess other people with a large user base would also welcome it. In the latter case I have to think about a alternative way to go for the future. At the moment my solution is to use an older version of autofs for suse10.0 installations since this older autofs version simply works for me but this is of course not an ideal solution.

Quoted 1 line
Quoted 1 line

Any comments?

raven> Yes.

raven> I was wondering what can be done about this also.

Quoted 8 lines

raven> All that I can offer is to make a patch to remove the locking from raven> autofs and another for mount (util-linux) to hopefully fix the mtab raven> locking. If you are prepared to carry these non-standard patches we raven> can see how it goes. Somewhat more testing would be required before raven> removing the locking from the distribution.

What, exactly, do you think is broken about the mtab locking? I remember spending a few hours with that code, and it looked sane to me.

I'm not sure yet but I had a bug report on it.

It appears that there is a situation in which autofs thinks the lock is still held when it is not. A race (no doubt) or maybe a missing test in the wait. So my feeling of wanting to eliminate the locking returns again. Sorry.

I received a patch that rewrote the lock code as well but I haven't looked closely at it yet.

OTOH Adrain Bunk is the util-linux maintainer (for a while now it seems) and I recently sent a patch to him for mount that might fix the locking.

I'll forward the mail later? It just explains what I think the problem might be and how the cause recently jumped out at me when looking at the mount code.

I really think it would be better if the locking could be done in mount. It should be much simpler to get it right there instead of in autofs.

Ian

#12 lore raw
Quoted 4 lines · Ian Kent

It appears that there is a situation in which autofs thinks the lock is still held when it is not. A race (no doubt) or maybe a missing test in the wait. So my feeling of wanting to eliminate the locking returns again. Sorry.

Agreed that problems in mount's lock should be fixed, but my diagnosis of the autofs situation went like this: it acquires its lock, then it tries to do a nested automount, and the nested instance can't get the lock. I suggested statting the referent in advance, to trigger the nested mount ahead of time. Autofs might do this: if it decides (before acquiring the mount) that it's going to do a bind mount, then it stats the referent, triggering nested automount(s) if any. Would it disrupt the logic too much to recognize the bind mount before getting the lock?

If we trust mount's lock, and don't do locking in autofs, I wonder if nested automounts would put mount into exactly the same deadlock that autofs is getting into now?

James F. Carter Voice 310 825 2897 FAX 310 206 6673
UCLA-Mathnet; 6115 MSA; 405 Hilgard Ave.; Los Angeles, CA, USA 90095-1555
Email: [email protected] http://www.math.ucla.edu/~jimc (q.v. for PGP key)

maintainer
#13 lore raw
Quoted 7 lines · Jim Carter
Quoted 4 lines · Ian Kent

It appears that there is a situation in which autofs thinks the lock is still held when it is not. A race (no doubt) or maybe a missing test in the wait. So my feeling of wanting to eliminate the locking returns again. Sorry.

Quoted 8 lines

Agreed that problems in mount's lock should be fixed, but my diagnosis of the autofs situation went like this: it acquires its lock, then it tries to do a nested automount, and the nested instance can't get the lock. I suggested statting the referent in advance, to trigger the nested mount ahead of time. Autofs might do this: if it decides (before acquiring the mount) that it's going to do a bind mount, then it stats the referent, triggering nested automount(s) if any. Would it disrupt the logic too much to recognize the bind mount before getting the lock?

Yes. I think that is an innovative way to use program maps indeed and should work.

But would be a little difficult to write for some.

The other reason that this is a hot issue for me is that as, Mike Jagdis points out, the locking as is will block all NFS mounts to all servers if mount hangs on a broken server. I know a lot of work has gone into code to check that a server is available before mounting but mount could still hang for some other reason.

Quoted 4 lines

If we trust mount's lock, and don't do locking in autofs, I wonder if nested automounts would put mount into exactly the same deadlock that autofs is getting into now?

I don't think so because in mount the lock is used to update the mtab after the mount has been completed. This won't trigger a further mount.

The problem is the broad scope of the lock when used in autofs.

Ian

#14 lore raw
In reply to Ian Kent

==> Regarding Re: [autofs] Unable to mount with autofs-4.1.4: aquire_lock: can't lock lock file timed out: /var/lock/autofs; Ian Kent <[email protected]> adds:

Quoted 6 lines · Rainer Krienke
Quoted 6 lines

Hello,

using the autofs package from suse10.0 (autofs-4.1.4-6.i586.rpm; autofs4 kernel module, Kernel2.6.13-15) NFS mounts of user directories fail when using indirect mounts. The problem can be reproduced in a certrain setup describes below. Because of this, the description is a bit lenghty.

raven> It's good to see that SuSE is attempting to keep up with the autofs raven> versions. If you have the oppertunity, Rainer, please thank them for raven> me.

Quoted 16 lines
Quoted 16 lines

The maps for automount are taken from NIS. To mount a users directory via NFS eg. /home/krienke on a client entries from the NIS-maps auto.home and auto.vol are used. auto.master is configured like this:

/home auto.home -intr /import auto.vol -intr

In auto.home there is this entry for each user like "krienke":

krienke localhost:/import/user2/krienke

In auto.vol you find another entry to handle the "user2" key starting at /import from above (there are more than one nfsservers exporting user1, user2, ... each with about 2000 users):

user2 nfssrv2:/export/user2

Quoted 12 lines
Quoted 4 lines

nfssrv2 ist one of our NFS servers for home directories. So basically we nfs mount a volume containing all the users on this server on /import/user2 on the client and then we mount /home/krienke on /import/user2/krienke on the client (the advantage of this indirect 2

Quoted 8 lines

layer mount is that we avoid problems with too many mounts for users on one client since bind mounts are used for the users home). This mount was (up to 9.3) automatically mounted as a bind mount by automount. Up to suse9.3 (using autofs4-4.1.3) this worked without problems and if I replace the suse10 autofs rpm by the suse9.3 autofs4 rpm it again does work. I can also manually issue the mount command logged by automunt below (mount -t nfs -s -o intr nfssrv2:/export/user2 /import/user2) and it works without any problems.

raven> As Jeff has said this sort of nesting of mounts is, in general, not raven> supported by autofs and it worked previously because the locking was raven> less broken in 4.1.3 than in 4.1.4 (yes its still broken in 4.1.4).

raven> Can this case be done safely?

raven> I'm not entirely sure of the answer to this but I've never liked raven> using locking in autofs. I introduced it only to prevent mtab raven> corruption during mount (correct me if you have a different raven> recollection Jeff). It happens during rapid mount activity such as raven> when there as a largish number of entries in the master map (of the raven> order of 50 or more).

I'm not sure why it was introduced. When looking at the code, the only thing I could deduce was that we do locking in autofs in order to not issue a ton of mounts all at once. Because the mount command has a timeout for each mount, and because each mount will take some amount of time to complete, there exists a possibility of getting failed mounts due to a timeout or lack of resources. That was my only guess.

I have seen mtab corruption in the field, but typically only in the presence of mvfs (the clearcase file system).

-Jeff

#15 lore raw
Quoted 14 lines

raven> As Jeff has said this sort of nesting of mounts is, in general, not raven> supported by autofs and it worked previously because the locking was raven> less broken in 4.1.3 than in 4.1.4 (yes its still broken in 4.1.4).

raven> Can this case be done safely?

raven> I'm not entirely sure of the answer to this but I've never liked raven> using locking in autofs. I introduced it only to prevent mtab raven> corruption during mount (correct me if you have a different raven> recollection Jeff). It happens during rapid mount activity such as raven> when there as a largish number of entries in the master map (of the raven> order of 50 or more).

Quoted 6 lines

I'm not sure why it was introduced. When looking at the code, the only thing I could deduce was that we do locking in autofs in order to not issue a ton of mounts all at once. Because the mount command has a timeout for each mount, and because each mount will take some amount of time to complete, there exists a possibility of getting failed mounts due to a timeout or lack of resources. That was my only guess.

Yes, with lots of mounts within a short time, you can easily run out of available reserved ports (since many of them end up in a TIME_WAIT state for a while). We changed mount to simply wait and retry in such cases. I can send you the patch we're currently using, if you really want it, but I'd implement it differently if I were to do it again (i.e. as implemented it retries a fixed number of times; I think it would be better to retry until the timeout specified in the timeo parameter expires so that port starvation isn't handled differently than other problems).

Quoted 3 lines

I have seen mtab corruption in the field, but typically only in the presence of mvfs (the clearcase file system).

There aren't enough hours in the day to go into all the problems induced by mvfs.....

A message that is not in the archive (sent off-list or not yet received): [email protected]

#17 lore raw
Quoted 8 lines · you
Quoted 6 lines · Rainer Krienke

Hello,

using the autofs package from suse10.0 (autofs-4.1.4-6.i586.rpm; autofs4 kernel module, Kernel2.6.13-15) NFS mounts of user directories fail when using indirect mounts. The problem can be reproduced in a certrain setup describes below. Because of this, the description is a bit lenghty.

Quoted 5 lines

Here is a patch to add a configure option to disable locking when calling mount. It also adds a patch for mount that I hope will prevent mtab coruption. Obviousy autofs needs to be built with the option added to configure.

I tried the patch (compiled with --disable-mount-locking) on a opensuse10 client. For me it seems to work. I wrote a script that randomly selects users from our NIS auto.home map and accesses the home directory. After a while I had about 4000 mounts on the client (99.9% bind mounts of course) and nothing went wrong as far as I saw. The most important thing for me is of course that using this patch my solution for hierarchcal mounts of the home directories does work again.

Thanks and have a nice day
Rainer

Signature · 6 lines
---------------------------------------------------------------------------
Rainer Krienke, Universitaet Koblenz, Rechenzentrum, Raum A022
Universitaetsstrasse 1, 56070 Koblenz, Tel: +49 261287 -1312, Fax: -1001312
Mail: [email protected], Web: http://www.uni-koblenz.de/~krienke
Get my public PGP key: http://www.uni-koblenz.de/~krienke/mypgp.html
---------------------------------------------------------------------------

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs

maintainer
#18 lore raw
Quoted 15 lines · Rainer Krienke
Quoted 8 lines · you
Quoted 6 lines · Rainer Krienke

Hello,

using the autofs package from suse10.0 (autofs-4.1.4-6.i586.rpm; autofs4 kernel module, Kernel2.6.13-15) NFS mounts of user directories fail when using indirect mounts. The problem can be reproduced in a certrain setup describes below. Because of this, the description is a bit lenghty.

Quoted 5 lines

Here is a patch to add a configure option to disable locking when calling mount. It also adds a patch for mount that I hope will prevent mtab coruption. Obviousy autofs needs to be built with the option added to configure.

Quoted 7 lines

I tried the patch (compiled with --disable-mount-locking) on a opensuse10 client. For me it seems to work. I wrote a script that randomly selects users from our NIS auto.home map and accesses the home directory. After a while I had about 4000 mounts on the client (99.9% bind mounts of course) and nothing went wrong as far as I saw. The most important thing for me is of course that using this patch my solution for hierarchcal mounts of the home directories does work again.

Great.

I'll merge the configure option into the next release.

You understand that this will not be the default because of problems that other people might have and the dependence on mount locking working.

Perhaps in time....

Ian