Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

autofs: change catatonic setting to a bit flag

Change the superblock info. catatonic setting to be part of a flags bit
field.

Link: http://lkml.kernel.org/r/154296973142.9889.17275721668508589639.stgit@pluto-themaw-net
Signed-off-by: Ian Kent <raven@themaw.net>
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Ian Kent and committed by
Linus Torvalds
9d8719a4 9bf964c9

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