aboutsummaryrefslogtreecommitdiffstats
path: root/fs/autofs4
diff options
context:
space:
mode:
Diffstat (limited to 'fs/autofs4')
-rw-r--r--fs/autofs4/inode.c18
-rw-r--r--fs/autofs4/waitq.c6
2 files changed, 19 insertions, 5 deletions
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
index 51fd8595bf85..9c48250fd726 100644
--- a/fs/autofs4/inode.c
+++ b/fs/autofs4/inode.c
@@ -99,6 +99,9 @@ static void autofs4_force_release(struct autofs_sb_info *sbi)
99 struct dentry *this_parent = sbi->sb->s_root; 99 struct dentry *this_parent = sbi->sb->s_root;
100 struct list_head *next; 100 struct list_head *next;
101 101
102 if (!sbi->sb->s_root)
103 return;
104
102 spin_lock(&dcache_lock); 105 spin_lock(&dcache_lock);
103repeat: 106repeat:
104 next = this_parent->d_subdirs.next; 107 next = this_parent->d_subdirs.next;
@@ -146,6 +149,15 @@ void autofs4_kill_sb(struct super_block *sb)
146{ 149{
147 struct autofs_sb_info *sbi = autofs4_sbi(sb); 150 struct autofs_sb_info *sbi = autofs4_sbi(sb);
148 151
152 /*
153 * In the event of a failure in get_sb_nodev the superblock
154 * info is not present so nothing else has been setup, so
155 * just call kill_anon_super when we are called from
156 * deactivate_super.
157 */
158 if (!sbi)
159 goto out_kill_sb;
160
149 sb->s_fs_info = NULL; 161 sb->s_fs_info = NULL;
150 162
151 if ( !sbi->catatonic ) 163 if ( !sbi->catatonic )
@@ -156,6 +168,7 @@ void autofs4_kill_sb(struct super_block *sb)
156 168
157 kfree(sbi); 169 kfree(sbi);
158 170
171out_kill_sb:
159 DPRINTK("shutting down"); 172 DPRINTK("shutting down");
160 kill_anon_super(sb); 173 kill_anon_super(sb);
161} 174}
@@ -310,7 +323,8 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
310 s->s_fs_info = sbi; 323 s->s_fs_info = sbi;
311 sbi->magic = AUTOFS_SBI_MAGIC; 324 sbi->magic = AUTOFS_SBI_MAGIC;
312 sbi->pipefd = -1; 325 sbi->pipefd = -1;
313 sbi->catatonic = 0; 326 sbi->pipe = NULL;
327 sbi->catatonic = 1;
314 sbi->exp_timeout = 0; 328 sbi->exp_timeout = 0;
315 sbi->oz_pgrp = process_group(current); 329 sbi->oz_pgrp = process_group(current);
316 sbi->sb = s; 330 sbi->sb = s;
@@ -388,6 +402,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
388 goto fail_fput; 402 goto fail_fput;
389 sbi->pipe = pipe; 403 sbi->pipe = pipe;
390 sbi->pipefd = pipefd; 404 sbi->pipefd = pipefd;
405 sbi->catatonic = 0;
391 406
392 /* 407 /*
393 * Success! Install the root dentry now to indicate completion. 408 * Success! Install the root dentry now to indicate completion.
@@ -412,6 +427,7 @@ fail_ino:
412 kfree(ino); 427 kfree(ino);
413fail_free: 428fail_free:
414 kfree(sbi); 429 kfree(sbi);
430 s->s_fs_info = NULL;
415fail_unlock: 431fail_unlock:
416 return -EINVAL; 432 return -EINVAL;
417} 433}
diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c
index c0a6c8d445c7..1e4a539f4417 100644
--- a/fs/autofs4/waitq.c
+++ b/fs/autofs4/waitq.c
@@ -41,10 +41,8 @@ void autofs4_catatonic_mode(struct autofs_sb_info *sbi)
41 wake_up_interruptible(&wq->queue); 41 wake_up_interruptible(&wq->queue);
42 wq = nwq; 42 wq = nwq;
43 } 43 }
44 if (sbi->pipe) { 44 fput(sbi->pipe); /* Close the pipe */
45 fput(sbi->pipe); /* Close the pipe */ 45 sbi->pipe = NULL;
46 sbi->pipe = NULL;
47 }
48} 46}
49 47
50static int autofs4_write(struct file *file, const void *addr, int bytes) 48static int autofs4_write(struct file *file, const void *addr, int bytes)