]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
autofs: change catatonic setting to a bit flag
authorIan Kent <raven@themaw.net>
Thu, 3 Jan 2019 23:27:39 +0000 (15:27 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 4 Jan 2019 21:13:47 +0000 (13:13 -0800)
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>
fs/autofs/autofs_i.h
fs/autofs/dev-ioctl.c
fs/autofs/inode.c
fs/autofs/root.c
fs/autofs/waitq.c

index 64f693d355ada097aedbeae3b42a2d12609cb0a4..9b81c10ef251dc61138c9bbf68f5266daa369bc3 100644 (file)
@@ -103,16 +103,18 @@ struct autofs_wait_queue {
 
 #define AUTOFS_SBI_MAGIC 0x6d4a556d
 
+#define AUTOFS_SBI_CATATONIC   0x0001
+
 struct autofs_sb_info {
        u32 magic;
        int pipefd;
        struct file *pipe;
        struct pid *oz_pgrp;
-       int catatonic;
        int version;
        int sub_version;
        int min_proto;
        int max_proto;
+       unsigned int flags;
        unsigned long exp_timeout;
        unsigned int type;
        struct super_block *sb;
@@ -142,7 +144,8 @@ static inline struct autofs_info *autofs_dentry_ino(struct dentry *dentry)
  */
 static inline int autofs_oz_mode(struct autofs_sb_info *sbi)
 {
-       return sbi->catatonic || task_pgrp(current) == sbi->oz_pgrp;
+       return ((sbi->flags & AUTOFS_SBI_CATATONIC) ||
+                task_pgrp(current) == sbi->oz_pgrp);
 }
 
 struct inode *autofs_get_inode(struct super_block *, umode_t);
index 752983aafb846bdaa7739f02649e8d0fcef0d877..e9fe74d1541bbab6c9bf062b9b5bd268b5055c3e 100644 (file)
@@ -350,7 +350,7 @@ static int autofs_dev_ioctl_setpipefd(struct file *fp,
        pipefd = param->setpipefd.pipefd;
 
        mutex_lock(&sbi->wq_mutex);
-       if (!sbi->catatonic) {
+       if (!(sbi->flags & AUTOFS_SBI_CATATONIC)) {
                mutex_unlock(&sbi->wq_mutex);
                return -EBUSY;
        } else {
@@ -377,7 +377,7 @@ static int autofs_dev_ioctl_setpipefd(struct file *fp,
                swap(sbi->oz_pgrp, new_pid);
                sbi->pipefd = pipefd;
                sbi->pipe = pipe;
-               sbi->catatonic = 0;
+               sbi->flags &= ~AUTOFS_SBI_CATATONIC;
        }
 out:
        put_pid(new_pid);
index bd49b16f43fdd999caecbbc2757c7371207e40aa..3a94dbda36dd2ed64bf4bae886da9eb833c9c67c 100644 (file)
@@ -227,12 +227,12 @@ int autofs_fill_super(struct super_block *s, void *data, int silent)
        sbi->magic = AUTOFS_SBI_MAGIC;
        sbi->pipefd = -1;
        sbi->pipe = NULL;
-       sbi->catatonic = 1;
        sbi->exp_timeout = 0;
        sbi->oz_pgrp = NULL;
        sbi->sb = s;
        sbi->version = 0;
        sbi->sub_version = 0;
+       sbi->flags = AUTOFS_SBI_CATATONIC;
        set_autofs_type_indirect(&sbi->type);
        sbi->min_proto = 0;
        sbi->max_proto = 0;
@@ -318,7 +318,7 @@ int autofs_fill_super(struct super_block *s, void *data, int silent)
        if (ret < 0)
                goto fail_fput;
        sbi->pipe = pipe;
-       sbi->catatonic = 0;
+       sbi->flags &= ~AUTOFS_SBI_CATATONIC;
 
        /*
         * Success! Install the root dentry now to indicate completion.
index 782e57b911abcf0cd1d7aae2095333554e1f1d74..164ccd3402cf3d4e4a94c53dcb947bbd4c8f04e3 100644 (file)
@@ -510,7 +510,8 @@ static struct dentry *autofs_lookup(struct inode *dir,
        sbi = autofs_sbi(dir->i_sb);
 
        pr_debug("pid = %u, pgrp = %u, catatonic = %d, oz_mode = %d\n",
-                current->pid, task_pgrp_nr(current), sbi->catatonic,
+                current->pid, task_pgrp_nr(current),
+                sbi->flags & AUTOFS_SBI_CATATONIC,
                 autofs_oz_mode(sbi));
 
        active = autofs_lookup_active(dentry);
@@ -563,7 +564,7 @@ static int autofs_dir_symlink(struct inode *dir,
         * autofs mount is catatonic but the state of an autofs
         * file system needs to be preserved over restarts.
         */
-       if (sbi->catatonic)
+       if (sbi->flags & AUTOFS_SBI_CATATONIC)
                return -EACCES;
 
        BUG_ON(!ino);
@@ -626,7 +627,7 @@ static int autofs_dir_unlink(struct inode *dir, struct dentry *dentry)
         * autofs mount is catatonic but the state of an autofs
         * file system needs to be preserved over restarts.
         */
-       if (sbi->catatonic)
+       if (sbi->flags & AUTOFS_SBI_CATATONIC)
                return -EACCES;
 
        if (atomic_dec_and_test(&ino->count)) {
@@ -714,7 +715,7 @@ static int autofs_dir_rmdir(struct inode *dir, struct dentry *dentry)
         * autofs mount is catatonic but the state of an autofs
         * file system needs to be preserved over restarts.
         */
-       if (sbi->catatonic)
+       if (sbi->flags & AUTOFS_SBI_CATATONIC)
                return -EACCES;
 
        spin_lock(&sbi->lookup_lock);
@@ -759,7 +760,7 @@ static int autofs_dir_mkdir(struct inode *dir,
         * autofs mount is catatonic but the state of an autofs
         * file system needs to be preserved over restarts.
         */
-       if (sbi->catatonic)
+       if (sbi->flags & AUTOFS_SBI_CATATONIC)
                return -EACCES;
 
        pr_debug("dentry %p, creating %pd\n", dentry, dentry);
index f6385c6ef0a56afe90dee6f14dd9329ee62818c2..15a3e31d09045aef788b69f6f32e4e9f28ae672f 100644 (file)
@@ -20,14 +20,14 @@ void autofs_catatonic_mode(struct autofs_sb_info *sbi)
        struct autofs_wait_queue *wq, *nwq;
 
        mutex_lock(&sbi->wq_mutex);
-       if (sbi->catatonic) {
+       if (sbi->flags & AUTOFS_SBI_CATATONIC) {
                mutex_unlock(&sbi->wq_mutex);
                return;
        }
 
        pr_debug("entering catatonic mode\n");
 
-       sbi->catatonic = 1;
+       sbi->flags |= AUTOFS_SBI_CATATONIC;
        wq = sbi->queues;
        sbi->queues = NULL;     /* Erase all wait queues */
        while (wq) {
@@ -255,7 +255,7 @@ static int validate_request(struct autofs_wait_queue **wait,
        struct autofs_wait_queue *wq;
        struct autofs_info *ino;
 
-       if (sbi->catatonic)
+       if (sbi->flags & AUTOFS_SBI_CATATONIC)
                return -ENOENT;
 
        /* Wait in progress, continue; */
@@ -290,7 +290,7 @@ static int validate_request(struct autofs_wait_queue **wait,
                        if (mutex_lock_interruptible(&sbi->wq_mutex))
                                return -EINTR;
 
-                       if (sbi->catatonic)
+                       if (sbi->flags & AUTOFS_SBI_CATATONIC)
                                return -ENOENT;
 
                        wq = autofs_find_wait(sbi, qstr);
@@ -359,7 +359,7 @@ int autofs_wait(struct autofs_sb_info *sbi,
        pid_t tgid;
 
        /* In catatonic mode, we don't wait for nobody */
-       if (sbi->catatonic)
+       if (sbi->flags & AUTOFS_SBI_CATATONIC)
                return -ENOENT;
 
        /*