diff options
author | Ian Kent <raven@themaw.net> | 2006-03-27 01:14:46 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-27 08:44:39 -0800 |
commit | 1aff3c8b0511b5bb54acf7859e0c6ec9ae7287a9 (patch) | |
tree | be50f4c89a14240b568010da1b0ce3c182352afc /fs/autofs4/expire.c | |
parent | 1ce12bad85863478619688c0c7363f93a9e5edb8 (diff) | |
download | kernel_i9300_mainline-1aff3c8b0511b5bb54acf7859e0c6ec9ae7287a9.zip kernel_i9300_mainline-1aff3c8b0511b5bb54acf7859e0c6ec9ae7287a9.tar.gz kernel_i9300_mainline-1aff3c8b0511b5bb54acf7859e0c6ec9ae7287a9.tar.bz2 |
[PATCH] autofs4: fix false negative return from expire
Fix the case where an expire returns busy on a tree mount when it is in fact
not busy. This case was overlooked when the patch to prevent the expiring
away of "scaffolding" directories for tree mounts was applied.
The problem arises when a tree of mounts is a member of a map with other keys.
The current logic will not expire the tree if any other mount in the map is
busy. The solution is to maintain a "minimum" use count for each autofs
dentry and compare this to the actual dentry usage count during expire.
Signed-off-by: Ian Kent <raven@themaw.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/autofs4/expire.c')
-rw-r--r-- | fs/autofs4/expire.c | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c index 165fe9e..053d92a 100644 --- a/fs/autofs4/expire.c +++ b/fs/autofs4/expire.c @@ -101,6 +101,7 @@ static int autofs4_tree_busy(struct vfsmount *mnt, unsigned long timeout, int do_now) { + struct autofs_info *ino; struct dentry *p; DPRINTK("top %p %.*s", @@ -110,14 +111,6 @@ static int autofs4_tree_busy(struct vfsmount *mnt, if (!simple_positive(top)) return 1; - /* Timeout of a tree mount is determined by its top dentry */ - if (!autofs4_can_expire(top, timeout, do_now)) - return 1; - - /* Is someone visiting anywhere in the tree ? */ - if (may_umount_tree(mnt)) - return 1; - spin_lock(&dcache_lock); for (p = top; p; p = next_dentry(p, top)) { /* Negative dentry - give up */ @@ -130,17 +123,40 @@ static int autofs4_tree_busy(struct vfsmount *mnt, p = dget(p); spin_unlock(&dcache_lock); + /* + * Is someone visiting anywhere in the subtree ? + * If there's no mount we need to check the usage + * count for the autofs dentry. + */ + ino = autofs4_dentry_ino(p); if (d_mountpoint(p)) { - /* First busy => tree busy */ if (autofs4_mount_busy(mnt, p)) { dput(p); return 1; } + } else { + unsigned int ino_count = atomic_read(&ino->count); + + /* allow for dget above and top is already dgot */ + if (p == top) + ino_count += 2; + else + ino_count++; + + if (atomic_read(&p->d_count) > ino_count) { + dput(p); + return 1; + } } dput(p); spin_lock(&dcache_lock); } spin_unlock(&dcache_lock); + + /* Timeout of a tree mount is ultimately determined by its top dentry */ + if (!autofs4_can_expire(top, timeout, do_now)) + return 1; + return 0; } |