Merge branch 'akpm-current/current'
[deliverable/linux.git] / fs / autofs4 / inode.c
index 61b21051bd5ad9322a58ef1caa7cccc09d25ba2b..f35ead78ba067556fcc89564258b3801da071fa4 100644 (file)
@@ -274,6 +274,23 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
                goto fail_dput;
        }
 
+       /* Test versions first */
+       if (sbi->max_proto < AUTOFS_MIN_PROTO_VERSION ||
+           sbi->min_proto > AUTOFS_MAX_PROTO_VERSION) {
+               pr_err("kernel does not match daemon version "
+                      "daemon (%d, %d) kernel (%d, %d)\n",
+                      sbi->min_proto, sbi->max_proto,
+                      AUTOFS_MIN_PROTO_VERSION, AUTOFS_MAX_PROTO_VERSION);
+               goto fail_dput;
+       }
+
+       /* Establish highest kernel protocol version */
+       if (sbi->max_proto > AUTOFS_MAX_PROTO_VERSION)
+               sbi->version = AUTOFS_MAX_PROTO_VERSION;
+       else
+               sbi->version = sbi->max_proto;
+       sbi->sub_version = AUTOFS_PROTO_SUBVERSION;
+
        if (pgrp_set) {
                sbi->oz_pgrp = find_get_pid(pgrp);
                if (!sbi->oz_pgrp) {
@@ -291,29 +308,12 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
        root_inode->i_fop = &autofs4_root_operations;
        root_inode->i_op = &autofs4_dir_inode_operations;
 
-       /* Couldn't this be tested earlier? */
-       if (sbi->max_proto < AUTOFS_MIN_PROTO_VERSION ||
-           sbi->min_proto > AUTOFS_MAX_PROTO_VERSION) {
-               pr_err("kernel does not match daemon version "
-                      "daemon (%d, %d) kernel (%d, %d)\n",
-                      sbi->min_proto, sbi->max_proto,
-                      AUTOFS_MIN_PROTO_VERSION, AUTOFS_MAX_PROTO_VERSION);
-               goto fail_dput;
-       }
-
-       /* Establish highest kernel protocol version */
-       if (sbi->max_proto > AUTOFS_MAX_PROTO_VERSION)
-               sbi->version = AUTOFS_MAX_PROTO_VERSION;
-       else
-               sbi->version = sbi->max_proto;
-       sbi->sub_version = AUTOFS_PROTO_SUBVERSION;
-
        pr_debug("pipe fd = %d, pgrp = %u\n", pipefd, pid_nr(sbi->oz_pgrp));
        pipe = fget(pipefd);
 
        if (!pipe) {
                pr_err("could not open pipe file descriptor\n");
-               goto fail_dput;
+               goto fail_put_pid;
        }
        ret = autofs_prepare_pipe(pipe);
        if (ret < 0)
@@ -334,14 +334,14 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
 fail_fput:
        pr_err("pipe file descriptor does not contain proper ops\n");
        fput(pipe);
-       /* fall through */
+fail_put_pid:
+       put_pid(sbi->oz_pgrp);
 fail_dput:
        dput(root);
        goto fail_free;
 fail_ino:
-       kfree(ino);
+       autofs4_free_ino(ino);
 fail_free:
-       put_pid(sbi->oz_pgrp);
        kfree(sbi);
        s->s_fs_info = NULL;
        return ret;
@@ -368,7 +368,8 @@ struct inode *autofs4_get_inode(struct super_block *sb, umode_t mode)
                inode->i_fop = &autofs4_dir_operations;
        } else if (S_ISLNK(mode)) {
                inode->i_op = &autofs4_symlink_inode_operations;
-       }
+       } else
+               WARN_ON(1);
 
        return inode;
 }
This page took 0.026216 seconds and 5 git commands to generate.