autofsv4: "ghost" entries prevent timeout of mounts

From: Thomas Richter
Date: Wed Mar 14 2012 - 17:05:56 EST


Dear kernel developers,

starting with at least kernel version 3.2.9, but probably earlier, mounting autofs with the --ghost option to create dummy directory entries in its mount point prevents the autofs mounts from timing out. Instead, the mounts persist and are never unmounted.

This problem did not exist in kernel 2.6.35.13, at least, so autofs must have been broken somewhere between 2.3.35.13 and 3.2.9.

/etc/auto.master reads as follows:

# $Id: auto.master,v 1.2 1997/10/06 21:52:03 hpa Exp $
# Sample auto.master file
# Format of this file:
# mountpoint map options
# For details of the format look at autofs(8).
#
# Note: Due to a bug in the init.d/autofs script, there
# *MUST* be a blank space behind the options (here: -t=10 <--).
# Unlike the debian reference, options must be given in the
# form "-option=<value>".
#
# -g is broken and stops automatic unmounting from working.
#

/var/autofs/misc /etc/auto.misc -g -t=2

/etc/auto.misc is as follows:

# $Id: auto.misc,v 1.2 1997/10/06 21:52:04 hpa Exp $
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# Details may be found in the autofs(5) manpage

cdrom0 -fstype=auto,noatime,rw,user,nodev,nosuid :/dev/cdrom0
cdrom1 -fstype=auto,noatime,rw,user,nodev,nosuid :/dev/cdrom1
zip -fstype=auto,nodev,nosuid :/dev/zip
usbstick -fstype=auto,noatime,rw,user,nodev,nosuid,gid=floppy,umask=0200 :/dev/usbstick
usbdisk -fstype=auto,noatime,rw,user,nodev,nosuid :/dev/usbdisk
camera -fstype=auto,noatime,rw,user,nodev,nosuid,gid=floppy,umask=0200 :/dev/camera
floppy -fstype=auto,rw,async,nodev,nosuid,umask=000 :/dev/fd0

/etc/default/autofs contains the following non-default entries:

MASTER_MAP_NAME="/etc/auto.master"
TIMEOUT=2 # <- also makes no difference
NEGATIVE_TIMEOUT=1 # <- neither this
BROWSE_MODE="no"
USE_MISC_DEVICE="no" # <- makes no difference, actually

Userspace tools are from Debian Squeeze (is there a relation? Might they break autofs?)

How to reproduce:

Instead a medium in one of the auto-mounted devices, e.g. cdrom0,
mount it by going into /var/autofs/misc/cdrom0, then leave the directory. Wait for the timeout (or longer). Testing with "mount" shows that the corresponding device file remains mounted, regardless how long you wait.


Best regards,

Thomas
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/