diff options
author | Ian Kent <raven@themaw.net> | 2008-07-24 00:30:28 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-24 13:47:32 -0400 |
commit | 06a3598552dc3b2b30eb18bd53bbac2a901489d7 (patch) | |
tree | bb209268deac3b12d63d07c67a76ba10561f6a11 /fs/autofs4/expire.c | |
parent | ec6e8c7d3f9073336ec7b2eed3fcda6f922087c3 (diff) |
autofs4: reorganize expire pending wait function calls
This patch re-orgnirzes the checking for and waiting on active expires and
elininates redundant checks.
Signed-off-by: Ian Kent <raven@themaw.net>
Cc: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/autofs4/expire.c')
-rw-r--r-- | fs/autofs4/expire.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c index 705b9f057fb3..cdabb796ff01 100644 --- a/fs/autofs4/expire.c +++ b/fs/autofs4/expire.c | |||
@@ -402,6 +402,35 @@ found: | |||
402 | return expired; | 402 | return expired; |
403 | } | 403 | } |
404 | 404 | ||
405 | int autofs4_expire_wait(struct dentry *dentry) | ||
406 | { | ||
407 | struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); | ||
408 | struct autofs_info *ino = autofs4_dentry_ino(dentry); | ||
409 | int status; | ||
410 | |||
411 | /* Block on any pending expire */ | ||
412 | spin_lock(&sbi->fs_lock); | ||
413 | if (ino->flags & AUTOFS_INF_EXPIRING) { | ||
414 | spin_unlock(&sbi->fs_lock); | ||
415 | |||
416 | DPRINTK("waiting for expire %p name=%.*s", | ||
417 | dentry, dentry->d_name.len, dentry->d_name.name); | ||
418 | |||
419 | status = autofs4_wait(sbi, dentry, NFY_NONE); | ||
420 | wait_for_completion(&ino->expire_complete); | ||
421 | |||
422 | DPRINTK("expire done status=%d", status); | ||
423 | |||
424 | if (d_unhashed(dentry)) | ||
425 | return -EAGAIN; | ||
426 | |||
427 | return status; | ||
428 | } | ||
429 | spin_unlock(&sbi->fs_lock); | ||
430 | |||
431 | return 0; | ||
432 | } | ||
433 | |||
405 | /* Perform an expiry operation */ | 434 | /* Perform an expiry operation */ |
406 | int autofs4_expire_run(struct super_block *sb, | 435 | int autofs4_expire_run(struct super_block *sb, |
407 | struct vfsmount *mnt, | 436 | struct vfsmount *mnt, |