[PATCH] do not stat autofs mounts(was Re: hall and autofs)

Ian Kent ikent at redhat.com
Fri May 19 19:15:40 PDT 2006


On Wed, 2006-05-17 at 16:05 -0400, John (J5) Palmieri wrote:
> I see, in /proc/mount will autofs mounted directories always come after
> the actual autofs mount point?  If so it is a trivial fix involving a
> hash.  If not we would have to do it in two passes over /proc/mount
> which could be problematic.  

Yes. In version 4.x autofs always manages mount points that are within
the autofs filesystem. They are essentially always indirect autofs
mounts.

In version 5.x you will also see direct mount point triggers that are an
"autofs" filesystem and when triggered will mount the filesystem on top
of the trigger. There can also be nesting of mounts where, for example,
an autofs trigger has another filesystem mounted over it, perhaps NFS,
and further autofs triggers mounted within it etc. This is the "mount on
demand only" of export hierarchies from servers. 

> 
> On Wed, 2006-05-17 at 21:50 +0200, Stefan Seyfried wrote:
> > On Wed, May 17, 2006 at 02:59:34PM -0400, John (J5) Palmieri wrote:
> > > Here is a patch to ignore autofs mounts when stating.  I basically just
> > > added a || strcmp (fstype, "autofs") == 0 to the nfs patch.  It is built
> > > in Fedora Rawhide and seems to work.
> > 
> > Well, it does not hurt, but it will for sure not help.
> > Accessing an autofs mount point does - nothing.
> > Accessing the directory _below_ the autofs mount point triggers the mount or
> > renews the timeout.
> > The directory below the mount point has the fs type of its filesystem.
> > 
> > Do this to test:
> > /etc/auto.master:
> > ####################################
> > /test	/etc/auto.test
> > ############################
> > /etc/auto.test:
> > cd	-fstype=auto	:/dev/hdc
> > # use your CD device
> > 
> > now start the automounter, access /test/cd (with a cd in the drive).
> > /proc/mounts:
> > automount(pid30397) /test autofs rw 0 0
> > /dev/hdc /test/cd iso9660 ro 0 0
> > 
> > if you now stat /test/cd from HAL every few seconds, it will never expire.
> > 
> > To fix this, you need to collect a list of all autofs mountpoints and skip
> > everything below them.
> > 
> > > +		 * If this is an autofs mount (fstype == 'autofs') ignore the mount. Reason:
> > > +		 *  1. stats on mounts managed by autofs will cause the mount
> > > +		 *     point to be remounted during an unmount
> > 
> > well, but you do not catch the mount point with this check...
> > 
> > > -		if (strcmp(mnt.mnt_type, "nfs") == 0)
> > > +		if (strcmp(mnt.mnt_type, "nfs") == 0 ||
> > > +		    strcmp(mnt.mnt_type, "autofs") == 0)
> > >  			continue;
> > 
> > does not hurt, but i'd bet that it also does not help. ;-)



More information about the hal mailing list