diff options
Diffstat (limited to 'fs/autofs4/expire.c')
-rw-r--r-- | fs/autofs4/expire.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c index d8e6d421c27f..57725d4a8c59 100644 --- a/fs/autofs4/expire.c +++ b/fs/autofs4/expire.c | |||
@@ -310,26 +310,29 @@ struct dentry *autofs4_expire_direct(struct super_block *sb, | |||
310 | now = jiffies; | 310 | now = jiffies; |
311 | timeout = sbi->exp_timeout; | 311 | timeout = sbi->exp_timeout; |
312 | 312 | ||
313 | spin_lock(&sbi->fs_lock); | ||
314 | ino = autofs4_dentry_ino(root); | ||
315 | /* No point expiring a pending mount */ | ||
316 | if (ino->flags & AUTOFS_INF_PENDING) | ||
317 | goto out; | ||
318 | if (!autofs4_direct_busy(mnt, root, timeout, do_now)) { | 313 | if (!autofs4_direct_busy(mnt, root, timeout, do_now)) { |
314 | spin_lock(&sbi->fs_lock); | ||
315 | ino = autofs4_dentry_ino(root); | ||
316 | /* No point expiring a pending mount */ | ||
317 | if (ino->flags & AUTOFS_INF_PENDING) { | ||
318 | spin_unlock(&sbi->fs_lock); | ||
319 | goto out; | ||
320 | } | ||
319 | ino->flags |= AUTOFS_INF_WANT_EXPIRE; | 321 | ino->flags |= AUTOFS_INF_WANT_EXPIRE; |
320 | spin_unlock(&sbi->fs_lock); | 322 | spin_unlock(&sbi->fs_lock); |
321 | synchronize_rcu(); | 323 | synchronize_rcu(); |
322 | spin_lock(&sbi->fs_lock); | ||
323 | if (!autofs4_direct_busy(mnt, root, timeout, do_now)) { | 324 | if (!autofs4_direct_busy(mnt, root, timeout, do_now)) { |
325 | spin_lock(&sbi->fs_lock); | ||
324 | ino->flags |= AUTOFS_INF_EXPIRING; | 326 | ino->flags |= AUTOFS_INF_EXPIRING; |
325 | init_completion(&ino->expire_complete); | 327 | init_completion(&ino->expire_complete); |
326 | spin_unlock(&sbi->fs_lock); | 328 | spin_unlock(&sbi->fs_lock); |
327 | return root; | 329 | return root; |
328 | } | 330 | } |
331 | spin_lock(&sbi->fs_lock); | ||
329 | ino->flags &= ~AUTOFS_INF_WANT_EXPIRE; | 332 | ino->flags &= ~AUTOFS_INF_WANT_EXPIRE; |
333 | spin_unlock(&sbi->fs_lock); | ||
330 | } | 334 | } |
331 | out: | 335 | out: |
332 | spin_unlock(&sbi->fs_lock); | ||
333 | dput(root); | 336 | dput(root); |
334 | 337 | ||
335 | return NULL; | 338 | return NULL; |
@@ -495,8 +498,9 @@ found: | |||
495 | return expired; | 498 | return expired; |
496 | } | 499 | } |
497 | 500 | ||
498 | int autofs4_expire_wait(struct dentry *dentry, int rcu_walk) | 501 | int autofs4_expire_wait(const struct path *path, int rcu_walk) |
499 | { | 502 | { |
503 | struct dentry *dentry = path->dentry; | ||
500 | struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); | 504 | struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); |
501 | struct autofs_info *ino = autofs4_dentry_ino(dentry); | 505 | struct autofs_info *ino = autofs4_dentry_ino(dentry); |
502 | int status; | 506 | int status; |
@@ -525,7 +529,7 @@ retry: | |||
525 | 529 | ||
526 | pr_debug("waiting for expire %p name=%pd\n", dentry, dentry); | 530 | pr_debug("waiting for expire %p name=%pd\n", dentry, dentry); |
527 | 531 | ||
528 | status = autofs4_wait(sbi, dentry, NFY_NONE); | 532 | status = autofs4_wait(sbi, path, NFY_NONE); |
529 | wait_for_completion(&ino->expire_complete); | 533 | wait_for_completion(&ino->expire_complete); |
530 | 534 | ||
531 | pr_debug("expire done status=%d\n", status); | 535 | pr_debug("expire done status=%d\n", status); |
@@ -592,11 +596,12 @@ int autofs4_do_expire_multi(struct super_block *sb, struct vfsmount *mnt, | |||
592 | 596 | ||
593 | if (dentry) { | 597 | if (dentry) { |
594 | struct autofs_info *ino = autofs4_dentry_ino(dentry); | 598 | struct autofs_info *ino = autofs4_dentry_ino(dentry); |
599 | const struct path path = { .mnt = mnt, .dentry = dentry }; | ||
595 | 600 | ||
596 | /* This is synchronous because it makes the daemon a | 601 | /* This is synchronous because it makes the daemon a |
597 | * little easier | 602 | * little easier |
598 | */ | 603 | */ |
599 | ret = autofs4_wait(sbi, dentry, NFY_EXPIRE); | 604 | ret = autofs4_wait(sbi, &path, NFY_EXPIRE); |
600 | 605 | ||
601 | spin_lock(&sbi->fs_lock); | 606 | spin_lock(&sbi->fs_lock); |
602 | /* avoid rapid-fire expire attempts if expiry fails */ | 607 | /* avoid rapid-fire expire attempts if expiry fails */ |