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>
This commit is contained in:
@ -402,6 +402,35 @@ found:
|
||||
return expired;
|
||||
}
|
||||
|
||||
int autofs4_expire_wait(struct dentry *dentry)
|
||||
{
|
||||
struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
|
||||
struct autofs_info *ino = autofs4_dentry_ino(dentry);
|
||||
int status;
|
||||
|
||||
/* Block on any pending expire */
|
||||
spin_lock(&sbi->fs_lock);
|
||||
if (ino->flags & AUTOFS_INF_EXPIRING) {
|
||||
spin_unlock(&sbi->fs_lock);
|
||||
|
||||
DPRINTK("waiting for expire %p name=%.*s",
|
||||
dentry, dentry->d_name.len, dentry->d_name.name);
|
||||
|
||||
status = autofs4_wait(sbi, dentry, NFY_NONE);
|
||||
wait_for_completion(&ino->expire_complete);
|
||||
|
||||
DPRINTK("expire done status=%d", status);
|
||||
|
||||
if (d_unhashed(dentry))
|
||||
return -EAGAIN;
|
||||
|
||||
return status;
|
||||
}
|
||||
spin_unlock(&sbi->fs_lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Perform an expiry operation */
|
||||
int autofs4_expire_run(struct super_block *sb,
|
||||
struct vfsmount *mnt,
|
||||
|
Reference in New Issue
Block a user