diff options
Diffstat (limited to 'fs/autofs4/expire.c')
-rw-r--r-- | fs/autofs4/expire.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c index 19f5bea2704f..705b9f057fb3 100644 --- a/fs/autofs4/expire.c +++ b/fs/autofs4/expire.c | |||
@@ -259,13 +259,15 @@ static struct dentry *autofs4_expire_direct(struct super_block *sb, | |||
259 | now = jiffies; | 259 | now = jiffies; |
260 | timeout = sbi->exp_timeout; | 260 | timeout = sbi->exp_timeout; |
261 | 261 | ||
262 | /* Lock the tree as we must expire as a whole */ | ||
263 | spin_lock(&sbi->fs_lock); | 262 | spin_lock(&sbi->fs_lock); |
264 | if (!autofs4_direct_busy(mnt, root, timeout, do_now)) { | 263 | if (!autofs4_direct_busy(mnt, root, timeout, do_now)) { |
265 | struct autofs_info *ino = autofs4_dentry_ino(root); | 264 | struct autofs_info *ino = autofs4_dentry_ino(root); |
266 | 265 | if (d_mountpoint(root)) { | |
267 | /* Set this flag early to catch sys_chdir and the like */ | 266 | ino->flags |= AUTOFS_INF_MOUNTPOINT; |
267 | root->d_mounted--; | ||
268 | } | ||
268 | ino->flags |= AUTOFS_INF_EXPIRING; | 269 | ino->flags |= AUTOFS_INF_EXPIRING; |
270 | init_completion(&ino->expire_complete); | ||
269 | spin_unlock(&sbi->fs_lock); | 271 | spin_unlock(&sbi->fs_lock); |
270 | return root; | 272 | return root; |
271 | } | 273 | } |
@@ -392,6 +394,7 @@ found: | |||
392 | expired, (int)expired->d_name.len, expired->d_name.name); | 394 | expired, (int)expired->d_name.len, expired->d_name.name); |
393 | ino = autofs4_dentry_ino(expired); | 395 | ino = autofs4_dentry_ino(expired); |
394 | ino->flags |= AUTOFS_INF_EXPIRING; | 396 | ino->flags |= AUTOFS_INF_EXPIRING; |
397 | init_completion(&ino->expire_complete); | ||
395 | spin_unlock(&sbi->fs_lock); | 398 | spin_unlock(&sbi->fs_lock); |
396 | spin_lock(&dcache_lock); | 399 | spin_lock(&dcache_lock); |
397 | list_move(&expired->d_parent->d_subdirs, &expired->d_u.d_child); | 400 | list_move(&expired->d_parent->d_subdirs, &expired->d_u.d_child); |
@@ -429,6 +432,7 @@ int autofs4_expire_run(struct super_block *sb, | |||
429 | spin_lock(&sbi->fs_lock); | 432 | spin_lock(&sbi->fs_lock); |
430 | ino = autofs4_dentry_ino(dentry); | 433 | ino = autofs4_dentry_ino(dentry); |
431 | ino->flags &= ~AUTOFS_INF_EXPIRING; | 434 | ino->flags &= ~AUTOFS_INF_EXPIRING; |
435 | complete_all(&ino->expire_complete); | ||
432 | spin_unlock(&sbi->fs_lock); | 436 | spin_unlock(&sbi->fs_lock); |
433 | 437 | ||
434 | return ret; | 438 | return ret; |
@@ -457,8 +461,14 @@ int autofs4_expire_multi(struct super_block *sb, struct vfsmount *mnt, | |||
457 | /* This is synchronous because it makes the daemon a | 461 | /* This is synchronous because it makes the daemon a |
458 | little easier */ | 462 | little easier */ |
459 | ret = autofs4_wait(sbi, dentry, NFY_EXPIRE); | 463 | ret = autofs4_wait(sbi, dentry, NFY_EXPIRE); |
464 | |||
460 | spin_lock(&sbi->fs_lock); | 465 | spin_lock(&sbi->fs_lock); |
466 | if (ino->flags & AUTOFS_INF_MOUNTPOINT) { | ||
467 | sb->s_root->d_mounted++; | ||
468 | ino->flags &= ~AUTOFS_INF_MOUNTPOINT; | ||
469 | } | ||
461 | ino->flags &= ~AUTOFS_INF_EXPIRING; | 470 | ino->flags &= ~AUTOFS_INF_EXPIRING; |
471 | complete_all(&ino->expire_complete); | ||
462 | spin_unlock(&sbi->fs_lock); | 472 | spin_unlock(&sbi->fs_lock); |
463 | dput(dentry); | 473 | dput(dentry); |
464 | } | 474 | } |