diff options
author | NeilBrown <neilb@suse.de> | 2014-10-13 18:52:18 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-13 20:18:16 -0400 |
commit | 6ece08e6187a62dd5bdf7c49539980571922c551 (patch) | |
tree | 8fd68d91e7feb62145c66c89c2fe6fa459fd9df8 /fs/autofs4 | |
parent | a5d1dba1430f059d5bb4bf1d95274ff01ccad3d9 (diff) |
autofs4: make "autofs4_can_expire" idempotent.
Have a "test" function change the value it is testing can be confusing,
particularly as a future patch will be calling this function twice.
So move the update for 'last_used' to avoid repeat expiry to the place
where the final determination on what to expire is known.
Signed-off-by: NeilBrown <neilb@suse.de>
Reviewed-by: Ian Kent <raven@themaw.net>
Tested-by: Ian Kent <raven@themaw.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/autofs4')
-rw-r--r-- | fs/autofs4/expire.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c index d03bedc7369f..af141fc8cfe6 100644 --- a/fs/autofs4/expire.c +++ b/fs/autofs4/expire.c | |||
@@ -30,12 +30,6 @@ static inline int autofs4_can_expire(struct dentry *dentry, | |||
30 | /* Too young to die */ | 30 | /* Too young to die */ |
31 | if (!timeout || time_after(ino->last_used + timeout, now)) | 31 | if (!timeout || time_after(ino->last_used + timeout, now)) |
32 | return 0; | 32 | return 0; |
33 | |||
34 | /* update last_used here :- | ||
35 | - obviously makes sense if it is in use now | ||
36 | - less obviously, prevents rapid-fire expire | ||
37 | attempts if expire fails the first time */ | ||
38 | ino->last_used = now; | ||
39 | } | 33 | } |
40 | return 1; | 34 | return 1; |
41 | } | 35 | } |
@@ -535,6 +529,8 @@ int autofs4_expire_run(struct super_block *sb, | |||
535 | 529 | ||
536 | spin_lock(&sbi->fs_lock); | 530 | spin_lock(&sbi->fs_lock); |
537 | ino = autofs4_dentry_ino(dentry); | 531 | ino = autofs4_dentry_ino(dentry); |
532 | /* avoid rapid-fire expire attempts if expiry fails */ | ||
533 | ino->last_used = now; | ||
538 | ino->flags &= ~AUTOFS_INF_EXPIRING; | 534 | ino->flags &= ~AUTOFS_INF_EXPIRING; |
539 | complete_all(&ino->expire_complete); | 535 | complete_all(&ino->expire_complete); |
540 | spin_unlock(&sbi->fs_lock); | 536 | spin_unlock(&sbi->fs_lock); |
@@ -561,6 +557,8 @@ int autofs4_do_expire_multi(struct super_block *sb, struct vfsmount *mnt, | |||
561 | ret = autofs4_wait(sbi, dentry, NFY_EXPIRE); | 557 | ret = autofs4_wait(sbi, dentry, NFY_EXPIRE); |
562 | 558 | ||
563 | spin_lock(&sbi->fs_lock); | 559 | spin_lock(&sbi->fs_lock); |
560 | /* avoid rapid-fire expire attempts if expiry fails */ | ||
561 | ino->last_used = now; | ||
564 | ino->flags &= ~AUTOFS_INF_EXPIRING; | 562 | ino->flags &= ~AUTOFS_INF_EXPIRING; |
565 | complete_all(&ino->expire_complete); | 563 | complete_all(&ino->expire_complete); |
566 | spin_unlock(&sbi->fs_lock); | 564 | spin_unlock(&sbi->fs_lock); |