I've been hacking the Linux automounter, autofs. Autofs will mount filesystems
on demand and expire them if they are idle for more than a certain length of
Solaris automounter implements a /net directory which can automatically
mount an entire tree of filesystems from an NFS server. This patch
allows autofs to do the same, but in a more general way.
It extends autofs's existing "executable map" mechanism, by allowing them
to return more than one mountpoint. A simple script (samples/auto.net in the autofs source tree,
for example) can look at an NFS server's exports, and return the appropriate
23 Oct 2000:
Well, after leaving it idle far too long, I've finished a burst of autofs4 updates.
There are now updates for kernel modules in 2.2 and 2.4, and a new version of
the autofs tools.
22nd Jan 2000:
HPA has asked me to manage getting together my changes and release them
as autofs-4. See below for the current release.
9th Jan 2000:
I've been hacking this quite a bit over the Christmas holidays
in preparation for 2.4. I've done work in the following areas:
Compatibility: The autofs daemon and kernel module are
now fully backwards and forwards compatible. That is, an unmodified autofs 3
daemon will work normally with an autofs 4 kernel filesystem, and an
autofs 4 daemon will be functionally equivalent to an autofs 3 daemon
when run with an autofs 3 kernel module.
Reliability: While my previous daemon patches were pretty
reliable, I've fixed a few narrow race conditions and cleaned up
some issues with shutting down the daemon (it will now kill any
pending mounts, for example).
Features: Current features of the new autofs:
- Tree mounts, which allows Solaris-style /net
- nosymlink NFS pseudo-option, which inhibits the
"symlink local directories" optimisation.
- submounts now work, and I consider it a bug if they
don't work the same as the unmodified 3.1.3 daemon.
If you're using an autofs4 module in 2.2 or 2.4, you must include
alias autofs autofs4 in your modules config file (/etc/conf.modules
This release is NOT compatible with the previous major release (around July 1999) of my
changes. You must update both the kernel and the daemon. This was necessary
to implement the v3 backwards-compatibility.
Shutdown is not very clean when the root-autofs directory is busy: the
daemon exits, leaving the filesystem in catatonic state (which
means it can be manually unmounted once it is no longer busy).
3.1.x does the same, and the problem is basically insoluble.
If you're using 2.4.0-testX onwards, and want to use namespace bindings to
do loopback local mounts, you need util-linux 2.10o or later.
Description of Changes
autofs filesystem now supports general directory trees, rather than just
a single layer of directories. This allows the daemon to construct
skeletons to hang mountpoints off.
direntry structures are used directly to hold the filesystem's state, rather
than using shadow structures. This simplifies the code overall.
Previously, when the kernel sent an expire message to the daemon it was
more an hint than anything else. Now the kernel makes certain that
the tree isn't busy before sending an expire message to the daemon.
It also blocks all new users of the tree until the umount is complete,
so that they can't see a partially mounted tree.
The kernel will use the highest protocol version that's common to
both itself and the daemon. This means that an autofs v4 filesystem
is quite happy to pretend to be an autofs v3 filesystem to an older
version of the daemon. This is easy because the autofs4 protocol
is a strict superset of the autofs3 protocol and doesn't change
any existing structures or formats.
There is now a formal state machine to
manage the state of the daemon, rather than a set of ad-hoc state variables.
This makes it much easier to reason about what's happening and what should
The signal handler communicates state updates via a pipe rather than through
shared variables. This is to make the synchronization with the main
thread easier, since it needs to block on both messages from the kernel
and state changes.
lookup_program map files can return multiple map entries, and thereby
trigger the mounting of several filesystems. This makes the "mount
all filesystems exported by host X" problem very easy.
- mount_nfs implements the nosymlink flag, which inhibits
the use of symlinks for local nfs mounts.
The daemon acts on both missing and expire messages through
- autofs mailing list
- Subscribe to email@example.com by visiting the mailman page.
- autofs ftp site
Autofs v4 testing versions are at
any comments, suggestions,bug reports, etc...
Back to Jeremy's page
Page updated 13 Feb 2000