net/route: enforce hoplimit max value
[linux-2.6-block.git] / Documentation / filesystems / automount-support.txt
CommitLineData
99ff6cf0
N
1Support is available for filesystems that wish to do automounting
2support (such as kAFS which can be found in fs/afs/ and NFS in
3fs/nfs/). This facility includes allowing in-kernel mounts to be
4performed and mountpoint degradation to be requested. The latter can
5also be requested by userspace.
1da177e4
LT
6
7
8======================
9IN-KERNEL AUTOMOUNTING
10======================
11
99ff6cf0 12See section "Mount Traps" of Documentation/filesystems/autofs4.txt
1da177e4
LT
13
14Then from userspace, you can just do something like:
15
16 [root@andromeda root]# mount -t afs \#root.afs. /afs
17 [root@andromeda root]# ls /afs
18 asd cambridge cambridge.redhat.com grand.central.org
19 [root@andromeda root]# ls /afs/cambridge
20 afsdoc
21 [root@andromeda root]# ls /afs/cambridge/afsdoc/
22 ChangeLog html LICENSE pdf RELNOTES-1.2.2
23
24And then if you look in the mountpoint catalogue, you'll see something like:
25
26 [root@andromeda root]# cat /proc/mounts
27 ...
28 #root.afs. /afs afs rw 0 0
29 #root.cell. /afs/cambridge.redhat.com afs rw 0 0
30 #afsdoc. /afs/cambridge.redhat.com/afsdoc afs rw 0 0
31
32
33===========================
34AUTOMATIC MOUNTPOINT EXPIRY
35===========================
36
37Automatic expiration of mountpoints is easy, provided you've mounted the
99ff6cf0 38mountpoint to be expired in the automounting procedure outlined separately.
1da177e4
LT
39
40To do expiration, you need to follow these steps:
41
99ff6cf0
N
42 (1) Create at least one list off which the vfsmounts to be expired can be
43 hung.
1da177e4 44
99ff6cf0
N
45 (2) When a new mountpoint is created in the ->d_automount method, add
46 the mnt to the list using mnt_set_expiry()
47 mnt_set_expiry(newmnt, &afs_vfsmounts);
1da177e4 48
99ff6cf0 49 (3) When you want mountpoints to be expired, call mark_mounts_for_expiry()
1da177e4
LT
50 with a pointer to this list. This will process the list, marking every
51 vfsmount thereon for potential expiry on the next call.
52
53 If a vfsmount was already flagged for expiry, and if its usage count is 1
54 (it's only referenced by its parent vfsmount), then it will be deleted
55 from the namespace and thrown away (effectively unmounted).
56
57 It may prove simplest to simply call this at regular intervals, using
58 some sort of timed event to drive it.
59
60The expiration flag is cleared by calls to mntput. This means that expiration
61will only happen on the second expiration request after the last time the
62mountpoint was accessed.
63
64If a mountpoint is moved, it gets removed from the expiration list. If a bind
65mount is made on an expirable mount, the new vfsmount will not be on the
66expiration list and will not expire.
67
68If a namespace is copied, all mountpoints contained therein will be copied,
69and the copies of those that are on an expiration list will be added to the
70same expiration list.
71
72
73=======================
74USERSPACE DRIVEN EXPIRY
75=======================
76
77As an alternative, it is possible for userspace to request expiry of any
78mountpoint (though some will be rejected - the current process's idea of the
79rootfs for example). It does this by passing the MNT_EXPIRE flag to
80umount(). This flag is considered incompatible with MNT_FORCE and MNT_DETACH.
81
82If the mountpoint in question is in referenced by something other than
83umount() or its parent mountpoint, an EBUSY error will be returned and the
84mountpoint will not be marked for expiration or unmounted.
85
86If the mountpoint was not already marked for expiry at that time, an EAGAIN
87error will be given and it won't be unmounted.
88
89Otherwise if it was already marked and it wasn't referenced, unmounting will
90take place as usual.
91
92Again, the expiration flag is cleared every time anything other than umount()
93looks at a mountpoint.