aboutsummaryrefslogtreecommitdiffstats
path: root/fs/autofs4
diff options
context:
space:
mode:
authorIan Kent <raven@themaw.net>2009-12-15 19:45:43 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-16 10:19:57 -0500
commitc4cd70b3e3e95cc2201a00edf6deb52327d73c6b (patch)
tree20150b87f5fdc0915db45937f727fd9e1aee0c74 /fs/autofs4
parent4f8427d1903148f9753eb35c5f51a8a865457329 (diff)
autofs4: use helper functions for expiring list
Define some simple helper functions for adding and deleting entries on the expiring dentry list. Signed-off-by: Ian Kent <raven@themaw.net> Cc: Sage Weil <sage@newdream.net> Cc: Al Viro <viro@ZenIV.linux.org.uk> Cc: Andreas Dilger <adilger@sun.com> Cc: Christoph Hellwig <hch@infradead.org> Cc: Yehuda Saheh <yehuda@newdream.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/autofs_i.h26
-rw-r--r--fs/autofs4/root.c15
2 files changed, 29 insertions, 12 deletions
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
index f3cf151a59e3..fe9fc235ee75 100644
--- a/fs/autofs4/autofs_i.h
+++ b/fs/autofs4/autofs_i.h
@@ -266,5 +266,31 @@ out:
266 return ret; 266 return ret;
267} 267}
268 268
269static inline void autofs4_add_expiring(struct dentry *dentry)
270{
271 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
272 struct autofs_info *ino = autofs4_dentry_ino(dentry);
273 if (ino) {
274 spin_lock(&sbi->lookup_lock);
275 if (list_empty(&ino->expiring))
276 list_add(&ino->expiring, &sbi->expiring_list);
277 spin_unlock(&sbi->lookup_lock);
278 }
279 return;
280}
281
282static inline void autofs4_del_expiring(struct dentry *dentry)
283{
284 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
285 struct autofs_info *ino = autofs4_dentry_ino(dentry);
286 if (ino) {
287 spin_lock(&sbi->lookup_lock);
288 if (!list_empty(&ino->expiring))
289 list_del_init(&ino->expiring);
290 spin_unlock(&sbi->lookup_lock);
291 }
292 return;
293}
294
269void autofs4_dentry_release(struct dentry *); 295void autofs4_dentry_release(struct dentry *);
270extern void autofs4_kill_sb(struct super_block *); 296extern void autofs4_kill_sb(struct super_block *);
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index 67d8d962168d..2954ac5fec75 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -563,10 +563,7 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, s
563 */ 563 */
564 ino = autofs4_dentry_ino(expiring); 564 ino = autofs4_dentry_ino(expiring);
565 autofs4_expire_wait(expiring); 565 autofs4_expire_wait(expiring);
566 spin_lock(&sbi->lookup_lock); 566 autofs4_del_expiring(expiring);
567 if (!list_empty(&ino->expiring))
568 list_del_init(&ino->expiring);
569 spin_unlock(&sbi->lookup_lock);
570 dput(expiring); 567 dput(expiring);
571 } 568 }
572 569
@@ -732,10 +729,7 @@ static int autofs4_dir_unlink(struct inode *dir, struct dentry *dentry)
732 dir->i_mtime = CURRENT_TIME; 729 dir->i_mtime = CURRENT_TIME;
733 730
734 spin_lock(&dcache_lock); 731 spin_lock(&dcache_lock);
735 spin_lock(&sbi->lookup_lock); 732 autofs4_add_expiring(dentry);
736 if (list_empty(&ino->expiring))
737 list_add(&ino->expiring, &sbi->expiring_list);
738 spin_unlock(&sbi->lookup_lock);
739 spin_lock(&dentry->d_lock); 733 spin_lock(&dentry->d_lock);
740 __d_drop(dentry); 734 __d_drop(dentry);
741 spin_unlock(&dentry->d_lock); 735 spin_unlock(&dentry->d_lock);
@@ -761,10 +755,7 @@ static int autofs4_dir_rmdir(struct inode *dir, struct dentry *dentry)
761 spin_unlock(&dcache_lock); 755 spin_unlock(&dcache_lock);
762 return -ENOTEMPTY; 756 return -ENOTEMPTY;
763 } 757 }
764 spin_lock(&sbi->lookup_lock); 758 autofs4_add_expiring(dentry);
765 if (list_empty(&ino->expiring))
766 list_add(&ino->expiring, &sbi->expiring_list);
767 spin_unlock(&sbi->lookup_lock);
768 spin_lock(&dentry->d_lock); 759 spin_lock(&dentry->d_lock);
769 __d_drop(dentry); 760 __d_drop(dentry);
770 spin_unlock(&dentry->d_lock); 761 spin_unlock(&dentry->d_lock);