aboutsummaryrefslogtreecommitdiffstats
path: root/fs/autofs4/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/autofs4/inode.c')
-rw-r--r--fs/autofs4/inode.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
index 1ad98d48e550..2335b1d6490f 100644
--- a/fs/autofs4/inode.c
+++ b/fs/autofs4/inode.c
@@ -46,6 +46,7 @@ struct autofs_info *autofs4_init_ino(struct autofs_info *ino,
46 ino->size = 0; 46 ino->size = 0;
47 47
48 ino->last_used = jiffies; 48 ino->last_used = jiffies;
49 atomic_set(&ino->count, 0);
49 50
50 ino->sbi = sbi; 51 ino->sbi = sbi;
51 52
@@ -64,10 +65,19 @@ struct autofs_info *autofs4_init_ino(struct autofs_info *ino,
64 65
65void autofs4_free_ino(struct autofs_info *ino) 66void autofs4_free_ino(struct autofs_info *ino)
66{ 67{
68 struct autofs_info *p_ino;
69
67 if (ino->dentry) { 70 if (ino->dentry) {
68 ino->dentry->d_fsdata = NULL; 71 ino->dentry->d_fsdata = NULL;
69 if (ino->dentry->d_inode) 72 if (ino->dentry->d_inode) {
73 struct dentry *parent = ino->dentry->d_parent;
74 if (atomic_dec_and_test(&ino->count)) {
75 p_ino = autofs4_dentry_ino(parent);
76 if (p_ino && parent != ino->dentry)
77 atomic_dec(&p_ino->count);
78 }
70 dput(ino->dentry); 79 dput(ino->dentry);
80 }
71 ino->dentry = NULL; 81 ino->dentry = NULL;
72 } 82 }
73 if (ino->free) 83 if (ino->free)