aboutsummaryrefslogtreecommitdiffstats
path: root/fs/autofs4/inode.c
diff options
context:
space:
mode:
authorIan Kent <raven@themaw.net>2007-02-20 16:58:10 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-20 20:10:15 -0500
commitf50b6f8691cae2e0064c499dd3ef3f31142987f0 (patch)
tree56c449af977772a42939afde5230c4809a057ffe /fs/autofs4/inode.c
parente8514478f63b95548a49576ba96b47edeb8596e0 (diff)
[PATCH] autofs4: fix another race between mount and expire
Jeff Moyer has identified a race between mount and expire. What happens is that during an expire the situation can arise that a directory is removed and another lookup is done before the expire issues a completion status to the kernel module. In this case, since the the lookup gets a new dentry, it doesn't know that there is an expire in progress and when it posts its mount request, matches the existing expire request and waits for its completion. ENOENT is then returned to user space from lookup (as the dentry passed in is now unhashed) without having performed the mount request. The solution used here is to keep track of dentrys in this unhashed state and reuse them, if possible, in order to preserve the flags. Additionally, this infrastructure will provide the framework for the reintroduction of caching of mount fails removed earlier in development. Signed-off-by: Ian Kent <raven@themaw.net> Acked-by: Jeff Moyer <jmoyer@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/autofs4/inode.c')
-rw-r--r--fs/autofs4/inode.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
index 5e458e096ef6..26063dc84a2a 100644
--- a/fs/autofs4/inode.c
+++ b/fs/autofs4/inode.c
@@ -48,6 +48,8 @@ struct autofs_info *autofs4_init_ino(struct autofs_info *ino,
48 ino->dentry = NULL; 48 ino->dentry = NULL;
49 ino->size = 0; 49 ino->size = 0;
50 50
51 INIT_LIST_HEAD(&ino->rehash);
52
51 ino->last_used = jiffies; 53 ino->last_used = jiffies;
52 atomic_set(&ino->count, 0); 54 atomic_set(&ino->count, 0);
53 55
@@ -158,14 +160,13 @@ void autofs4_kill_sb(struct super_block *sb)
158 if (!sbi) 160 if (!sbi)
159 goto out_kill_sb; 161 goto out_kill_sb;
160 162
161 sb->s_fs_info = NULL; 163 if (!sbi->catatonic)
162
163 if ( !sbi->catatonic )
164 autofs4_catatonic_mode(sbi); /* Free wait queues, close pipe */ 164 autofs4_catatonic_mode(sbi); /* Free wait queues, close pipe */
165 165
166 /* Clean up and release dangling references */ 166 /* Clean up and release dangling references */
167 autofs4_force_release(sbi); 167 autofs4_force_release(sbi);
168 168
169 sb->s_fs_info = NULL;
169 kfree(sbi); 170 kfree(sbi);
170 171
171out_kill_sb: 172out_kill_sb:
@@ -336,6 +337,8 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
336 mutex_init(&sbi->wq_mutex); 337 mutex_init(&sbi->wq_mutex);
337 spin_lock_init(&sbi->fs_lock); 338 spin_lock_init(&sbi->fs_lock);
338 sbi->queues = NULL; 339 sbi->queues = NULL;
340 spin_lock_init(&sbi->rehash_lock);
341 INIT_LIST_HEAD(&sbi->rehash_list);
339 s->s_blocksize = 1024; 342 s->s_blocksize = 1024;
340 s->s_blocksize_bits = 10; 343 s->s_blocksize_bits = 10;
341 s->s_magic = AUTOFS_SUPER_MAGIC; 344 s->s_magic = AUTOFS_SUPER_MAGIC;