diff options
author | David Howells <dhowells@redhat.com> | 2006-10-11 04:22:15 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-11 14:14:25 -0400 |
commit | 6ce315234aefcbc599dea390c15672156ebf9e7b (patch) | |
tree | ecf559a2b3f351dd35e274eb2d78fe6e2902c15c | |
parent | edc666e2ff9ec2e4e9510f1127c68c22cffc93f6 (diff) |
[PATCH] AUTOFS: Make sure all dentries refs are released before calling kill_anon_super()
Make sure all dentries refs are released before calling kill_anon_super() so
that the assumption that generic_shutdown_super() can completely destroy the
dentry tree for there will be no external references holds true.
What was being done in the put_super() superblock op, is now done in the
kill_sb() filesystem op instead, prior to calling kill_anon_super().
This makes the struct autofs_sb_info::root member variable redundant (since
sb->s_root is still available), and so that is removed. The calls to
shrink_dcache_sb() are also removed since they're also redundant as
shrink_dcache_for_umount() will now be called after the cleanup routine.
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Ian Kent <raven@themaw.net>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | fs/autofs4/autofs_i.h | 3 | ||||
-rw-r--r-- | fs/autofs4/init.c | 2 | ||||
-rw-r--r-- | fs/autofs4/inode.c | 22 | ||||
-rw-r--r-- | fs/autofs4/waitq.c | 1 |
4 files changed, 6 insertions, 22 deletions
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h index 480ab178cba5..b13f32c8aeee 100644 --- a/fs/autofs4/autofs_i.h +++ b/fs/autofs4/autofs_i.h | |||
@@ -94,7 +94,6 @@ struct autofs_wait_queue { | |||
94 | 94 | ||
95 | struct autofs_sb_info { | 95 | struct autofs_sb_info { |
96 | u32 magic; | 96 | u32 magic; |
97 | struct dentry *root; | ||
98 | int pipefd; | 97 | int pipefd; |
99 | struct file *pipe; | 98 | struct file *pipe; |
100 | pid_t oz_pgrp; | 99 | pid_t oz_pgrp; |
@@ -229,4 +228,4 @@ out: | |||
229 | } | 228 | } |
230 | 229 | ||
231 | void autofs4_dentry_release(struct dentry *); | 230 | void autofs4_dentry_release(struct dentry *); |
232 | 231 | extern void autofs4_kill_sb(struct super_block *); | |
diff --git a/fs/autofs4/init.c b/fs/autofs4/init.c index 5d9193332bef..723a1c5e361b 100644 --- a/fs/autofs4/init.c +++ b/fs/autofs4/init.c | |||
@@ -24,7 +24,7 @@ static struct file_system_type autofs_fs_type = { | |||
24 | .owner = THIS_MODULE, | 24 | .owner = THIS_MODULE, |
25 | .name = "autofs", | 25 | .name = "autofs", |
26 | .get_sb = autofs_get_sb, | 26 | .get_sb = autofs_get_sb, |
27 | .kill_sb = kill_anon_super, | 27 | .kill_sb = autofs4_kill_sb, |
28 | }; | 28 | }; |
29 | 29 | ||
30 | static int __init init_autofs4_fs(void) | 30 | static int __init init_autofs4_fs(void) |
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c index 800ce876caec..51fd8595bf85 100644 --- a/fs/autofs4/inode.c +++ b/fs/autofs4/inode.c | |||
@@ -96,7 +96,7 @@ void autofs4_free_ino(struct autofs_info *ino) | |||
96 | */ | 96 | */ |
97 | static void autofs4_force_release(struct autofs_sb_info *sbi) | 97 | static void autofs4_force_release(struct autofs_sb_info *sbi) |
98 | { | 98 | { |
99 | struct dentry *this_parent = sbi->root; | 99 | struct dentry *this_parent = sbi->sb->s_root; |
100 | struct list_head *next; | 100 | struct list_head *next; |
101 | 101 | ||
102 | spin_lock(&dcache_lock); | 102 | spin_lock(&dcache_lock); |
@@ -127,7 +127,7 @@ resume: | |||
127 | spin_lock(&dcache_lock); | 127 | spin_lock(&dcache_lock); |
128 | } | 128 | } |
129 | 129 | ||
130 | if (this_parent != sbi->root) { | 130 | if (this_parent != sbi->sb->s_root) { |
131 | struct dentry *dentry = this_parent; | 131 | struct dentry *dentry = this_parent; |
132 | 132 | ||
133 | next = this_parent->d_u.d_child.next; | 133 | next = this_parent->d_u.d_child.next; |
@@ -140,15 +140,9 @@ resume: | |||
140 | goto resume; | 140 | goto resume; |
141 | } | 141 | } |
142 | spin_unlock(&dcache_lock); | 142 | spin_unlock(&dcache_lock); |
143 | |||
144 | dput(sbi->root); | ||
145 | sbi->root = NULL; | ||
146 | shrink_dcache_sb(sbi->sb); | ||
147 | |||
148 | return; | ||
149 | } | 143 | } |
150 | 144 | ||
151 | static void autofs4_put_super(struct super_block *sb) | 145 | void autofs4_kill_sb(struct super_block *sb) |
152 | { | 146 | { |
153 | struct autofs_sb_info *sbi = autofs4_sbi(sb); | 147 | struct autofs_sb_info *sbi = autofs4_sbi(sb); |
154 | 148 | ||
@@ -163,6 +157,7 @@ static void autofs4_put_super(struct super_block *sb) | |||
163 | kfree(sbi); | 157 | kfree(sbi); |
164 | 158 | ||
165 | DPRINTK("shutting down"); | 159 | DPRINTK("shutting down"); |
160 | kill_anon_super(sb); | ||
166 | } | 161 | } |
167 | 162 | ||
168 | static int autofs4_show_options(struct seq_file *m, struct vfsmount *mnt) | 163 | static int autofs4_show_options(struct seq_file *m, struct vfsmount *mnt) |
@@ -189,7 +184,6 @@ static int autofs4_show_options(struct seq_file *m, struct vfsmount *mnt) | |||
189 | } | 184 | } |
190 | 185 | ||
191 | static struct super_operations autofs4_sops = { | 186 | static struct super_operations autofs4_sops = { |
192 | .put_super = autofs4_put_super, | ||
193 | .statfs = simple_statfs, | 187 | .statfs = simple_statfs, |
194 | .show_options = autofs4_show_options, | 188 | .show_options = autofs4_show_options, |
195 | }; | 189 | }; |
@@ -315,7 +309,6 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) | |||
315 | 309 | ||
316 | s->s_fs_info = sbi; | 310 | s->s_fs_info = sbi; |
317 | sbi->magic = AUTOFS_SBI_MAGIC; | 311 | sbi->magic = AUTOFS_SBI_MAGIC; |
318 | sbi->root = NULL; | ||
319 | sbi->pipefd = -1; | 312 | sbi->pipefd = -1; |
320 | sbi->catatonic = 0; | 313 | sbi->catatonic = 0; |
321 | sbi->exp_timeout = 0; | 314 | sbi->exp_timeout = 0; |
@@ -397,13 +390,6 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) | |||
397 | sbi->pipefd = pipefd; | 390 | sbi->pipefd = pipefd; |
398 | 391 | ||
399 | /* | 392 | /* |
400 | * Take a reference to the root dentry so we get a chance to | ||
401 | * clean up the dentry tree on umount. | ||
402 | * See autofs4_force_release. | ||
403 | */ | ||
404 | sbi->root = dget(root); | ||
405 | |||
406 | /* | ||
407 | * Success! Install the root dentry now to indicate completion. | 393 | * Success! Install the root dentry now to indicate completion. |
408 | */ | 394 | */ |
409 | s->s_root = root; | 395 | s->s_root = root; |
diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c index ce103e7b0bc3..c0a6c8d445c7 100644 --- a/fs/autofs4/waitq.c +++ b/fs/autofs4/waitq.c | |||
@@ -45,7 +45,6 @@ void autofs4_catatonic_mode(struct autofs_sb_info *sbi) | |||
45 | fput(sbi->pipe); /* Close the pipe */ | 45 | fput(sbi->pipe); /* Close the pipe */ |
46 | sbi->pipe = NULL; | 46 | sbi->pipe = NULL; |
47 | } | 47 | } |
48 | shrink_dcache_sb(sbi->sb); | ||
49 | } | 48 | } |
50 | 49 | ||
51 | static int autofs4_write(struct file *file, const void *addr, int bytes) | 50 | static int autofs4_write(struct file *file, const void *addr, int bytes) |