aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/autofs/autofs_i.h7
-rw-r--r--fs/autofs/dev-ioctl.c4
-rw-r--r--fs/autofs/inode.c4
-rw-r--r--fs/autofs/root.c11
-rw-r--r--fs/autofs/waitq.c10
5 files changed, 20 insertions, 16 deletions
diff --git a/fs/autofs/autofs_i.h b/fs/autofs/autofs_i.h
index 64f693d355ad..9b81c10ef251 100644
--- a/fs/autofs/autofs_i.h
+++ b/fs/autofs/autofs_i.h
@@ -103,16 +103,18 @@ struct autofs_wait_queue {
103 103
104#define AUTOFS_SBI_MAGIC 0x6d4a556d 104#define AUTOFS_SBI_MAGIC 0x6d4a556d
105 105
106#define AUTOFS_SBI_CATATONIC 0x0001
107
106struct autofs_sb_info { 108struct autofs_sb_info {
107 u32 magic; 109 u32 magic;
108 int pipefd; 110 int pipefd;
109 struct file *pipe; 111 struct file *pipe;
110 struct pid *oz_pgrp; 112 struct pid *oz_pgrp;
111 int catatonic;
112 int version; 113 int version;
113 int sub_version; 114 int sub_version;
114 int min_proto; 115 int min_proto;
115 int max_proto; 116 int max_proto;
117 unsigned int flags;
116 unsigned long exp_timeout; 118 unsigned long exp_timeout;
117 unsigned int type; 119 unsigned int type;
118 struct super_block *sb; 120 struct super_block *sb;
@@ -142,7 +144,8 @@ static inline struct autofs_info *autofs_dentry_ino(struct dentry *dentry)
142 */ 144 */
143static inline int autofs_oz_mode(struct autofs_sb_info *sbi) 145static inline int autofs_oz_mode(struct autofs_sb_info *sbi)
144{ 146{
145 return sbi->catatonic || task_pgrp(current) == sbi->oz_pgrp; 147 return ((sbi->flags & AUTOFS_SBI_CATATONIC) ||
148 task_pgrp(current) == sbi->oz_pgrp);
146} 149}
147 150
148struct inode *autofs_get_inode(struct super_block *, umode_t); 151struct inode *autofs_get_inode(struct super_block *, umode_t);
diff --git a/fs/autofs/dev-ioctl.c b/fs/autofs/dev-ioctl.c
index 752983aafb84..e9fe74d1541b 100644
--- a/fs/autofs/dev-ioctl.c
+++ b/fs/autofs/dev-ioctl.c
@@ -350,7 +350,7 @@ static int autofs_dev_ioctl_setpipefd(struct file *fp,
350 pipefd = param->setpipefd.pipefd; 350 pipefd = param->setpipefd.pipefd;
351 351
352 mutex_lock(&sbi->wq_mutex); 352 mutex_lock(&sbi->wq_mutex);
353 if (!sbi->catatonic) { 353 if (!(sbi->flags & AUTOFS_SBI_CATATONIC)) {
354 mutex_unlock(&sbi->wq_mutex); 354 mutex_unlock(&sbi->wq_mutex);
355 return -EBUSY; 355 return -EBUSY;
356 } else { 356 } else {
@@ -377,7 +377,7 @@ static int autofs_dev_ioctl_setpipefd(struct file *fp,
377 swap(sbi->oz_pgrp, new_pid); 377 swap(sbi->oz_pgrp, new_pid);
378 sbi->pipefd = pipefd; 378 sbi->pipefd = pipefd;
379 sbi->pipe = pipe; 379 sbi->pipe = pipe;
380 sbi->catatonic = 0; 380 sbi->flags &= ~AUTOFS_SBI_CATATONIC;
381 } 381 }
382out: 382out:
383 put_pid(new_pid); 383 put_pid(new_pid);
diff --git a/fs/autofs/inode.c b/fs/autofs/inode.c
index bd49b16f43fd..3a94dbda36dd 100644
--- a/fs/autofs/inode.c
+++ b/fs/autofs/inode.c
@@ -227,12 +227,12 @@ int autofs_fill_super(struct super_block *s, void *data, int silent)
227 sbi->magic = AUTOFS_SBI_MAGIC; 227 sbi->magic = AUTOFS_SBI_MAGIC;
228 sbi->pipefd = -1; 228 sbi->pipefd = -1;
229 sbi->pipe = NULL; 229 sbi->pipe = NULL;
230 sbi->catatonic = 1;
231 sbi->exp_timeout = 0; 230 sbi->exp_timeout = 0;
232 sbi->oz_pgrp = NULL; 231 sbi->oz_pgrp = NULL;
233 sbi->sb = s; 232 sbi->sb = s;
234 sbi->version = 0; 233 sbi->version = 0;
235 sbi->sub_version = 0; 234 sbi->sub_version = 0;
235 sbi->flags = AUTOFS_SBI_CATATONIC;
236 set_autofs_type_indirect(&sbi->type); 236 set_autofs_type_indirect(&sbi->type);
237 sbi->min_proto = 0; 237 sbi->min_proto = 0;
238 sbi->max_proto = 0; 238 sbi->max_proto = 0;
@@ -318,7 +318,7 @@ int autofs_fill_super(struct super_block *s, void *data, int silent)
318 if (ret < 0) 318 if (ret < 0)
319 goto fail_fput; 319 goto fail_fput;
320 sbi->pipe = pipe; 320 sbi->pipe = pipe;
321 sbi->catatonic = 0; 321 sbi->flags &= ~AUTOFS_SBI_CATATONIC;
322 322
323 /* 323 /*
324 * Success! Install the root dentry now to indicate completion. 324 * Success! Install the root dentry now to indicate completion.
diff --git a/fs/autofs/root.c b/fs/autofs/root.c
index 782e57b911ab..164ccd3402cf 100644
--- a/fs/autofs/root.c
+++ b/fs/autofs/root.c
@@ -510,7 +510,8 @@ static struct dentry *autofs_lookup(struct inode *dir,
510 sbi = autofs_sbi(dir->i_sb); 510 sbi = autofs_sbi(dir->i_sb);
511 511
512 pr_debug("pid = %u, pgrp = %u, catatonic = %d, oz_mode = %d\n", 512 pr_debug("pid = %u, pgrp = %u, catatonic = %d, oz_mode = %d\n",
513 current->pid, task_pgrp_nr(current), sbi->catatonic, 513 current->pid, task_pgrp_nr(current),
514 sbi->flags & AUTOFS_SBI_CATATONIC,
514 autofs_oz_mode(sbi)); 515 autofs_oz_mode(sbi));
515 516
516 active = autofs_lookup_active(dentry); 517 active = autofs_lookup_active(dentry);
@@ -563,7 +564,7 @@ static int autofs_dir_symlink(struct inode *dir,
563 * autofs mount is catatonic but the state of an autofs 564 * autofs mount is catatonic but the state of an autofs
564 * file system needs to be preserved over restarts. 565 * file system needs to be preserved over restarts.
565 */ 566 */
566 if (sbi->catatonic) 567 if (sbi->flags & AUTOFS_SBI_CATATONIC)
567 return -EACCES; 568 return -EACCES;
568 569
569 BUG_ON(!ino); 570 BUG_ON(!ino);
@@ -626,7 +627,7 @@ static int autofs_dir_unlink(struct inode *dir, struct dentry *dentry)
626 * autofs mount is catatonic but the state of an autofs 627 * autofs mount is catatonic but the state of an autofs
627 * file system needs to be preserved over restarts. 628 * file system needs to be preserved over restarts.
628 */ 629 */
629 if (sbi->catatonic) 630 if (sbi->flags & AUTOFS_SBI_CATATONIC)
630 return -EACCES; 631 return -EACCES;
631 632
632 if (atomic_dec_and_test(&ino->count)) { 633 if (atomic_dec_and_test(&ino->count)) {
@@ -714,7 +715,7 @@ static int autofs_dir_rmdir(struct inode *dir, struct dentry *dentry)
714 * autofs mount is catatonic but the state of an autofs 715 * autofs mount is catatonic but the state of an autofs
715 * file system needs to be preserved over restarts. 716 * file system needs to be preserved over restarts.
716 */ 717 */
717 if (sbi->catatonic) 718 if (sbi->flags & AUTOFS_SBI_CATATONIC)
718 return -EACCES; 719 return -EACCES;
719 720
720 spin_lock(&sbi->lookup_lock); 721 spin_lock(&sbi->lookup_lock);
@@ -759,7 +760,7 @@ static int autofs_dir_mkdir(struct inode *dir,
759 * autofs mount is catatonic but the state of an autofs 760 * autofs mount is catatonic but the state of an autofs
760 * file system needs to be preserved over restarts. 761 * file system needs to be preserved over restarts.
761 */ 762 */
762 if (sbi->catatonic) 763 if (sbi->flags & AUTOFS_SBI_CATATONIC)
763 return -EACCES; 764 return -EACCES;
764 765
765 pr_debug("dentry %p, creating %pd\n", dentry, dentry); 766 pr_debug("dentry %p, creating %pd\n", dentry, dentry);
diff --git a/fs/autofs/waitq.c b/fs/autofs/waitq.c
index f6385c6ef0a5..15a3e31d0904 100644
--- a/fs/autofs/waitq.c
+++ b/fs/autofs/waitq.c
@@ -20,14 +20,14 @@ void autofs_catatonic_mode(struct autofs_sb_info *sbi)
20 struct autofs_wait_queue *wq, *nwq; 20 struct autofs_wait_queue *wq, *nwq;
21 21
22 mutex_lock(&sbi->wq_mutex); 22 mutex_lock(&sbi->wq_mutex);
23 if (sbi->catatonic) { 23 if (sbi->flags & AUTOFS_SBI_CATATONIC) {
24 mutex_unlock(&sbi->wq_mutex); 24 mutex_unlock(&sbi->wq_mutex);
25 return; 25 return;
26 } 26 }
27 27
28 pr_debug("entering catatonic mode\n"); 28 pr_debug("entering catatonic mode\n");
29 29
30 sbi->catatonic = 1; 30 sbi->flags |= AUTOFS_SBI_CATATONIC;
31 wq = sbi->queues; 31 wq = sbi->queues;
32 sbi->queues = NULL; /* Erase all wait queues */ 32 sbi->queues = NULL; /* Erase all wait queues */
33 while (wq) { 33 while (wq) {
@@ -255,7 +255,7 @@ static int validate_request(struct autofs_wait_queue **wait,
255 struct autofs_wait_queue *wq; 255 struct autofs_wait_queue *wq;
256 struct autofs_info *ino; 256 struct autofs_info *ino;
257 257
258 if (sbi->catatonic) 258 if (sbi->flags & AUTOFS_SBI_CATATONIC)
259 return -ENOENT; 259 return -ENOENT;
260 260
261 /* Wait in progress, continue; */ 261 /* Wait in progress, continue; */
@@ -290,7 +290,7 @@ static int validate_request(struct autofs_wait_queue **wait,
290 if (mutex_lock_interruptible(&sbi->wq_mutex)) 290 if (mutex_lock_interruptible(&sbi->wq_mutex))
291 return -EINTR; 291 return -EINTR;
292 292
293 if (sbi->catatonic) 293 if (sbi->flags & AUTOFS_SBI_CATATONIC)
294 return -ENOENT; 294 return -ENOENT;
295 295
296 wq = autofs_find_wait(sbi, qstr); 296 wq = autofs_find_wait(sbi, qstr);
@@ -359,7 +359,7 @@ int autofs_wait(struct autofs_sb_info *sbi,
359 pid_t tgid; 359 pid_t tgid;
360 360
361 /* In catatonic mode, we don't wait for nobody */ 361 /* In catatonic mode, we don't wait for nobody */
362 if (sbi->catatonic) 362 if (sbi->flags & AUTOFS_SBI_CATATONIC)
363 return -ENOENT; 363 return -ENOENT;
364 364
365 /* 365 /*