diff options
Diffstat (limited to 'fs/autofs4/expire.c')
-rw-r--r-- | fs/autofs4/expire.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c index 31540a6404d9..500425e24fba 100644 --- a/fs/autofs4/expire.c +++ b/fs/autofs4/expire.c | |||
@@ -99,6 +99,10 @@ static int autofs4_check_tree(struct vfsmount *mnt, | |||
99 | if (!autofs4_can_expire(top, timeout, do_now)) | 99 | if (!autofs4_can_expire(top, timeout, do_now)) |
100 | return 0; | 100 | return 0; |
101 | 101 | ||
102 | /* Is someone visiting anywhere in the tree ? */ | ||
103 | if (may_umount_tree(mnt)) | ||
104 | return 0; | ||
105 | |||
102 | spin_lock(&dcache_lock); | 106 | spin_lock(&dcache_lock); |
103 | repeat: | 107 | repeat: |
104 | next = this_parent->d_subdirs.next; | 108 | next = this_parent->d_subdirs.next; |
@@ -270,10 +274,18 @@ static struct dentry *autofs4_expire(struct super_block *sb, | |||
270 | 274 | ||
271 | /* Case 2: tree mount, expire iff entire tree is not busy */ | 275 | /* Case 2: tree mount, expire iff entire tree is not busy */ |
272 | if (!exp_leaves) { | 276 | if (!exp_leaves) { |
277 | /* Lock the tree as we must expire as a whole */ | ||
278 | spin_lock(&sbi->fs_lock); | ||
273 | if (autofs4_check_tree(mnt, dentry, timeout, do_now)) { | 279 | if (autofs4_check_tree(mnt, dentry, timeout, do_now)) { |
274 | expired = dentry; | 280 | struct autofs_info *inf = autofs4_dentry_ino(dentry); |
275 | break; | 281 | |
282 | /* Set this flag early to catch sys_chdir and the like */ | ||
283 | inf->flags |= AUTOFS_INF_EXPIRING; | ||
284 | spin_unlock(&sbi->fs_lock); | ||
285 | expired = dentry; | ||
286 | break; | ||
276 | } | 287 | } |
288 | spin_unlock(&sbi->fs_lock); | ||
277 | /* Case 3: direct mount, expire individual leaves */ | 289 | /* Case 3: direct mount, expire individual leaves */ |
278 | } else { | 290 | } else { |
279 | expired = autofs4_check_leaves(mnt, dentry, timeout, do_now); | 291 | expired = autofs4_check_leaves(mnt, dentry, timeout, do_now); |