aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Kent <raven@themaw.net>2011-01-14 13:46:24 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2011-01-15 20:07:42 -0500
commit6651149371b842715906311b4631b8489cebf7e8 (patch)
tree4ad6941a353515edaada23426ec3b44724f40ca3
parent71e469db242c2eeb00faf9caf7d9e00150c00a6e (diff)
autofs4: Clean up autofs4_free_ino()
When this function is called the local reference count does't need to be updated since the dentry is going away and dput definitely must not be called here. Also the autofs info struct field inode isn't used so remove it. Signed-off-by: Ian Kent <raven@themaw.net> Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/autofs4/inode.c13
-rw-r--r--fs/autofs4/root.c9
2 files changed, 0 insertions, 22 deletions
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
index 427c35746340..3ecd2e2bcdbd 100644
--- a/fs/autofs4/inode.c
+++ b/fs/autofs4/inode.c
@@ -45,7 +45,6 @@ struct autofs_info *autofs4_init_ino(struct autofs_info *ino,
45 45
46 if (!reinit) { 46 if (!reinit) {
47 ino->flags = 0; 47 ino->flags = 0;
48 ino->inode = NULL;
49 ino->dentry = NULL; 48 ino->dentry = NULL;
50 ino->size = 0; 49 ino->size = 0;
51 INIT_LIST_HEAD(&ino->active); 50 INIT_LIST_HEAD(&ino->active);
@@ -76,19 +75,8 @@ struct autofs_info *autofs4_init_ino(struct autofs_info *ino,
76 75
77void autofs4_free_ino(struct autofs_info *ino) 76void autofs4_free_ino(struct autofs_info *ino)
78{ 77{
79 struct autofs_info *p_ino;
80
81 if (ino->dentry) { 78 if (ino->dentry) {
82 ino->dentry->d_fsdata = NULL; 79 ino->dentry->d_fsdata = NULL;
83 if (ino->dentry->d_inode) {
84 struct dentry *parent = ino->dentry->d_parent;
85 if (atomic_dec_and_test(&ino->count)) {
86 p_ino = autofs4_dentry_ino(parent);
87 if (p_ino && parent != ino->dentry)
88 atomic_dec(&p_ino->count);
89 }
90 dput(ino->dentry);
91 }
92 ino->dentry = NULL; 80 ino->dentry = NULL;
93 } 81 }
94 if (ino->free) 82 if (ino->free)
@@ -390,7 +378,6 @@ struct inode *autofs4_get_inode(struct super_block *sb,
390 if (inode == NULL) 378 if (inode == NULL)
391 return NULL; 379 return NULL;
392 380
393 inf->inode = inode;
394 inode->i_mode = inf->mode; 381 inode->i_mode = inf->mode;
395 if (sb->s_root) { 382 if (sb->s_root) {
396 inode->i_uid = sb->s_root->d_inode->i_uid; 383 inode->i_uid = sb->s_root->d_inode->i_uid;
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index 62c1229a4d31..8315565ed7d4 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -151,11 +151,8 @@ void autofs4_dentry_release(struct dentry *de)
151 DPRINTK("releasing %p", de); 151 DPRINTK("releasing %p", de);
152 152
153 inf = autofs4_dentry_ino(de); 153 inf = autofs4_dentry_ino(de);
154 de->d_fsdata = NULL;
155
156 if (inf) { 154 if (inf) {
157 struct autofs_sb_info *sbi = autofs4_sbi(de->d_sb); 155 struct autofs_sb_info *sbi = autofs4_sbi(de->d_sb);
158
159 if (sbi) { 156 if (sbi) {
160 spin_lock(&sbi->lookup_lock); 157 spin_lock(&sbi->lookup_lock);
161 if (!list_empty(&inf->active)) 158 if (!list_empty(&inf->active))
@@ -164,10 +161,6 @@ void autofs4_dentry_release(struct dentry *de)
164 list_del(&inf->expiring); 161 list_del(&inf->expiring);
165 spin_unlock(&sbi->lookup_lock); 162 spin_unlock(&sbi->lookup_lock);
166 } 163 }
167
168 inf->dentry = NULL;
169 inf->inode = NULL;
170
171 autofs4_free_ino(inf); 164 autofs4_free_ino(inf);
172 } 165 }
173} 166}
@@ -583,7 +576,6 @@ static int autofs4_dir_symlink(struct inode *dir,
583 p_ino = autofs4_dentry_ino(dentry->d_parent); 576 p_ino = autofs4_dentry_ino(dentry->d_parent);
584 if (p_ino && dentry->d_parent != dentry) 577 if (p_ino && dentry->d_parent != dentry)
585 atomic_inc(&p_ino->count); 578 atomic_inc(&p_ino->count);
586 ino->inode = inode;
587 579
588 ino->u.symlink = cp; 580 ino->u.symlink = cp;
589 dir->i_mtime = CURRENT_TIME; 581 dir->i_mtime = CURRENT_TIME;
@@ -713,7 +705,6 @@ static int autofs4_dir_mkdir(struct inode *dir, struct dentry *dentry, int mode)
713 p_ino = autofs4_dentry_ino(dentry->d_parent); 705 p_ino = autofs4_dentry_ino(dentry->d_parent);
714 if (p_ino && dentry->d_parent != dentry) 706 if (p_ino && dentry->d_parent != dentry)
715 atomic_inc(&p_ino->count); 707 atomic_inc(&p_ino->count);
716 ino->inode = inode;
717 inc_nlink(dir); 708 inc_nlink(dir);
718 dir->i_mtime = CURRENT_TIME; 709 dir->i_mtime = CURRENT_TIME;
719 710