]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
switch open-coded instances of d_make_root() to new helper
authorAl Viro <viro@zeniv.linux.org.uk>
Mon, 9 Jan 2012 03:15:13 +0000 (22:15 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Wed, 21 Mar 2012 01:29:35 +0000 (21:29 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
64 files changed:
arch/powerpc/platforms/cell/spufs/inode.c
arch/s390/hypfs/inode.c
drivers/misc/ibmasm/ibmasmfs.c
drivers/oprofile/oprofilefs.c
drivers/usb/core/inode.c
drivers/usb/gadget/f_fs.c
drivers/usb/gadget/inode.c
fs/9p/vfs_super.c
fs/adfs/super.c
fs/affs/super.c
fs/afs/super.c
fs/autofs4/inode.c
fs/befs/linuxvfs.c
fs/bfs/inode.c
fs/btrfs/super.c
fs/ceph/super.c
fs/cifs/cifsfs.c
fs/coda/inode.c
fs/configfs/mount.c
fs/cramfs/inode.c
fs/devpts/inode.c
fs/ecryptfs/main.c
fs/efs/super.c
fs/exofs/super.c
fs/ext2/super.c
fs/ext3/super.c
fs/ext4/super.c
fs/freevxfs/vxfs_super.c
fs/fuse/inode.c
fs/gfs2/ops_fstype.c
fs/hfs/super.c
fs/hostfs/hostfs_kern.c
fs/hpfs/super.c
fs/hppfs/hppfs.c
fs/hugetlbfs/inode.c
fs/isofs/inode.c
fs/jffs2/fs.c
fs/jfs/super.c
fs/libfs.c
fs/logfs/super.c
fs/ncpfs/inode.c
fs/nfs/getroot.c
fs/nilfs2/super.c
fs/ocfs2/dlmfs/dlmfs.c
fs/ocfs2/super.c
fs/omfs/inode.c
fs/openpromfs/inode.c
fs/proc/inode.c
fs/pstore/inode.c
fs/qnx4/inode.c
fs/ramfs/inode.c
fs/reiserfs/super.c
fs/romfs/super.c
fs/squashfs/super.c
fs/sysfs/mount.c
fs/sysv/super.c
fs/ubifs/super.c
fs/udf/super.c
fs/ufs/super.c
fs/xfs/xfs_super.c
ipc/mqueue.c
kernel/cgroup.c
mm/shmem.c
net/sunrpc/rpc_pipe.c

index d4a094ca96f3c18379d2a321514f9423c889012a..17b3211e36418a4c72af1b990b68c69be095f74b 100644 (file)
@@ -757,9 +757,9 @@ spufs_create_root(struct super_block *sb, void *data)
                goto out_iput;
 
        ret = -ENOMEM;
-       sb->s_root = d_alloc_root(inode);
+       sb->s_root = d_make_root(inode);
        if (!sb->s_root)
-               goto out_iput;
+               goto out;
 
        return 0;
 out_iput:
index 8a2a887478cc770141f7f8138ee0b8cce44dda54..6a2cb560e968ec1cd430200b0fb4cb9e2d3e87b7 100644 (file)
@@ -293,11 +293,9 @@ static int hypfs_fill_super(struct super_block *sb, void *data, int silent)
                return -ENOMEM;
        root_inode->i_op = &simple_dir_inode_operations;
        root_inode->i_fop = &simple_dir_operations;
-       sb->s_root = root_dentry = d_alloc_root(root_inode);
-       if (!root_dentry) {
-               iput(root_inode);
+       sb->s_root = root_dentry = d_make_root(root_inode);
+       if (!root_dentry)
                return -ENOMEM;
-       }
        if (MACHINE_IS_VM)
                rc = hypfs_vm_create_files(sb, root_dentry);
        else
index 35361753b4872842e1518bbdea5c4a953b2d5cf8..15f24f362208df68142e02d1ad8838a755cbc2d2 100644 (file)
@@ -129,11 +129,9 @@ static int ibmasmfs_fill_super (struct super_block *sb, void *data, int silent)
        root->i_op = &simple_dir_inode_operations;
        root->i_fop = ibmasmfs_dir_ops;
 
-       root_dentry = d_alloc_root(root);
-       if (!root_dentry) {
-               iput(root);
+       root_dentry = d_make_root(root);
+       if (!root_dentry)
                return -ENOMEM;
-       }
        sb->s_root = root_dentry;
 
        ibmasmfs_create_files(sb, root_dentry);
index 2f0aa0f700e63985a0abbe29573b3816e1ef1e47..277bb70b8d75452e84559bd9c460f0ed339b53ab 100644 (file)
@@ -251,11 +251,9 @@ static int oprofilefs_fill_super(struct super_block *sb, void *data, int silent)
                return -ENOMEM;
        root_inode->i_op = &simple_dir_inode_operations;
        root_inode->i_fop = &simple_dir_operations;
-       root_dentry = d_alloc_root(root_inode);
-       if (!root_dentry) {
-               iput(root_inode);
+       root_dentry = d_make_root(root_inode);
+       if (!root_dentry)
                return -ENOMEM;
-       }
 
        sb->s_root = root_dentry;
 
index 9e186f3da839c8d577438c447f60629153f89eab..bdaef8e36020948b20d4f7eb24693d348c1a2ce6 100644 (file)
@@ -462,16 +462,9 @@ static int usbfs_fill_super(struct super_block *sb, void *data, int silent)
        sb->s_op = &usbfs_ops;
        sb->s_time_gran = 1;
        inode = usbfs_get_inode(sb, S_IFDIR | 0755, 0);
-
-       if (!inode) {
-               dbg("%s: could not get inode!",__func__);
-               return -ENOMEM;
-       }
-
-       root = d_alloc_root(inode);
+       root = d_make_root(inode);
        if (!root) {
                dbg("%s: could not get root dentry!",__func__);
-               iput(inode);
                return -ENOMEM;
        }
        sb->s_root = root;
index f63dc6c150d2e4c80b3cdb9f1425c2f4bd4f9b8d..d825b248728a069978c60c7a84be5abab8c40d2d 100644 (file)
@@ -1063,13 +1063,9 @@ static int ffs_sb_fill(struct super_block *sb, void *_data, int silent)
                                  &simple_dir_operations,
                                  &simple_dir_inode_operations,
                                  &data->perms);
-       if (unlikely(!inode))
+       sb->s_root = d_make_root(inode);
+       if (unlikely(!sb->s_root))
                goto Enomem;
-       sb->s_root = d_alloc_root(inode);
-       if (unlikely(!sb->s_root)) {
-               iput(inode);
-               goto Enomem;
-       }
 
        /* EP0 file */
        if (unlikely(!ffs_sb_create_file(sb, "ep0", ffs,
index ae04266dba1b30f32caf19a16a0fb68eaea43ff7..c95eea43b63759db8eebe536a6db2fa30ea7d05b 100644 (file)
@@ -2059,10 +2059,8 @@ gadgetfs_fill_super (struct super_block *sb, void *opts, int silent)
        if (!inode)
                goto Enomem;
        inode->i_op = &simple_dir_inode_operations;
-       if (!(sb->s_root = d_alloc_root (inode))) {
-               iput(inode);
+       if (!(sb->s_root = d_make_root (inode)))
                goto Enomem;
-       }
 
        /* the ep0 file is named after the controller we expect;
         * user mode code can use it for sanity checks, like we do.
index 7b0cd87b07c20772b79395bb03afdb2bc5ebf414..10b7d3c9dba8541cab1794224e866765b1c928a5 100644 (file)
@@ -155,9 +155,8 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags,
                goto release_sb;
        }
 
-       root = d_alloc_root(inode);
+       root = d_make_root(inode);
        if (!root) {
-               iput(inode);
                retval = -ENOMEM;
                goto release_sb;
        }
index 8e3b36ace3051becfd0bd39ca1e8145c314d20d0..06fdcc9382c4d27d2effb1595b7480a402eaf7e9 100644 (file)
@@ -483,10 +483,9 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)
 
        sb->s_d_op = &adfs_dentry_operations;
        root = adfs_iget(sb, &root_obj);
-       sb->s_root = d_alloc_root(root);
+       sb->s_root = d_make_root(root);
        if (!sb->s_root) {
                int i;
-               iput(root);
                for (i = 0; i < asb->s_map_size; i++)
                        brelse(asb->s_map[i].dm_bh);
                kfree(asb->s_map);
index 8ba73fed79648f6494b73202fe0426070f3879ad..0782653a05a2d2d9098057572605fa75ef9900f3 100644 (file)
@@ -473,7 +473,7 @@ got_root:
        root_inode = affs_iget(sb, root_block);
        if (IS_ERR(root_inode)) {
                ret = PTR_ERR(root_inode);
-               goto out_error_noinode;
+               goto out_error;
        }
 
        if (AFFS_SB(sb)->s_flags & SF_INTL)
@@ -481,7 +481,7 @@ got_root:
        else
                sb->s_d_op = &affs_dentry_operations;
 
-       sb->s_root = d_alloc_root(root_inode);
+       sb->s_root = d_make_root(root_inode);
        if (!sb->s_root) {
                printk(KERN_ERR "AFFS: Get root inode failed\n");
                goto out_error;
@@ -494,9 +494,6 @@ got_root:
         * Begin the cascaded cleanup ...
         */
 out_error:
-       if (root_inode)
-               iput(root_inode);
-out_error_noinode:
        kfree(sbi->s_bitmap);
        affs_brelse(root_bh);
        kfree(sbi->s_prefix);
index 983ec59fc80d49501a5158cb1089b2da7324b556..f02b31e7e648ff67007990626b8b9f2641f694f3 100644 (file)
@@ -301,7 +301,6 @@ static int afs_fill_super(struct super_block *sb,
 {
        struct afs_super_info *as = sb->s_fs_info;
        struct afs_fid fid;
-       struct dentry *root = NULL;
        struct inode *inode = NULL;
        int ret;
 
@@ -327,18 +326,16 @@ static int afs_fill_super(struct super_block *sb,
                set_bit(AFS_VNODE_AUTOCELL, &AFS_FS_I(inode)->flags);
 
        ret = -ENOMEM;
-       root = d_alloc_root(inode);
-       if (!root)
+       sb->s_root = d_make_root(inode);
+       if (!sb->s_root)
                goto error;
 
        sb->s_d_op = &afs_fs_dentry_operations;
-       sb->s_root = root;
 
        _leave(" = 0");
        return 0;
 
 error:
-       iput(inode);
        _leave(" = %d", ret);
        return ret;
 }
index 06858d955120ed43fab44309f1bc978f11c24124..d8dc002e9cc39d4b15511a6cc6df4d6b8b39897f 100644 (file)
@@ -247,12 +247,9 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
        if (!ino)
                goto fail_free;
        root_inode = autofs4_get_inode(s, S_IFDIR | 0755);
-       if (!root_inode)
-               goto fail_ino;
-
-       root = d_alloc_root(root_inode);
+       root = d_make_root(root_inode);
        if (!root)
-               goto fail_iput;
+               goto fail_ino;
        pipe = NULL;
 
        root->d_fsdata = ino;
@@ -317,9 +314,6 @@ fail_fput:
 fail_dput:
        dput(root);
        goto fail_free;
-fail_iput:
-       printk("autofs: get root dentry failed\n");
-       iput(root_inode);
 fail_ino:
        kfree(ino);
 fail_free:
index 6e6d536767fe9c7f5964a2ce866e50db580ffebe..e18da23d42b5b163cb3a7f3dd8da9cdf76f9774d 100644 (file)
@@ -852,9 +852,8 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
                ret = PTR_ERR(root);
                goto unacquire_priv_sbp;
        }
-       sb->s_root = d_alloc_root(root);
+       sb->s_root = d_make_root(root);
        if (!sb->s_root) {
-               iput(root);
                befs_error(sb, "get root inode failed");
                goto unacquire_priv_sbp;
        }
index b0391bc402b14a22912c01457da5021c373704af..e23dc7c8b884138ec7eabd03d98367aef50d4b6b 100644 (file)
@@ -367,9 +367,8 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
                ret = PTR_ERR(inode);
                goto out2;
        }
-       s->s_root = d_alloc_root(inode);
+       s->s_root = d_make_root(inode);
        if (!s->s_root) {
-               iput(inode);
                ret = -ENOMEM;
                goto out2;
        }
index 3ce97b217cbeae21ef23e57fe2a605ed11572af1..81df3fec6a6d24b0ebc3e93ff449f2244f21e832 100644 (file)
@@ -629,7 +629,6 @@ static int btrfs_fill_super(struct super_block *sb,
                            void *data, int silent)
 {
        struct inode *inode;
-       struct dentry *root_dentry;
        struct btrfs_fs_info *fs_info = btrfs_sb(sb);
        struct btrfs_key key;
        int err;
@@ -660,15 +659,12 @@ static int btrfs_fill_super(struct super_block *sb,
                goto fail_close;
        }
 
-       root_dentry = d_alloc_root(inode);
-       if (!root_dentry) {
-               iput(inode);
+       sb->s_root = d_make_root(inode);
+       if (!sb->s_root) {
                err = -ENOMEM;
                goto fail_close;
        }
 
-       sb->s_root = root_dentry;
-
        save_mount_options(sb, data);
        cleancache_init_fs(sb);
        sb->s_flags |= MS_ACTIVE;
index 00de2c9568cd89b13af544b87bc2f43acefa8b30..256f852219261e66984384fe19bb7182bf8dd50a 100644 (file)
@@ -655,9 +655,8 @@ static struct dentry *open_root_dentry(struct ceph_fs_client *fsc,
                dout("open_root_inode success\n");
                if (ceph_ino(inode) == CEPH_INO_ROOT &&
                    fsc->sb->s_root == NULL) {
-                       root = d_alloc_root(inode);
+                       root = d_make_root(inode);
                        if (!root) {
-                               iput(inode);
                                root = ERR_PTR(-ENOMEM);
                                goto out;
                        }
index 8b7d7ff887927bd33442a90dfbfc1484d9c72fd9..418fc42fb8b284d3b43c9ccc1c6ac2046e944f28 100644 (file)
@@ -122,11 +122,9 @@ cifs_read_super(struct super_block *sb)
                goto out_no_root;
        }
 
-       sb->s_root = d_alloc_root(inode);
-
+       sb->s_root = d_make_root(inode);
        if (!sb->s_root) {
                rc = -ENOMEM;
-               iput(inode);
                goto out_no_root;
        }
 
index 32dafc875c1400f071ccca056e4b3406b13f30bb..05156c17b551de2f8a02a043018cc66b49b6ce41 100644 (file)
@@ -213,9 +213,8 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent)
 
        printk("coda_read_super: rootinode is %ld dev %s\n", 
               root->i_ino, root->i_sb->s_id);
-       sb->s_root = d_alloc_root(root);
+       sb->s_root = d_make_root(root);
        if (!sb->s_root) {
-               iput(root);
                error = -EINVAL;
                goto error;
        }
index 276e15cafd58e8b5171b8da6a8e503c99631cabd..07f60455f1c1cac2108a876d1cdc490caa2a7c64 100644 (file)
@@ -91,10 +91,9 @@ static int configfs_fill_super(struct super_block *sb, void *data, int silent)
                return -ENOMEM;
        }
 
-       root = d_alloc_root(inode);
+       root = d_make_root(inode);
        if (!root) {
                pr_debug("%s: could not get root dentry!\n",__func__);
-               iput(inode);
                return -ENOMEM;
        }
        config_group_init(&configfs_root_group);
index a2ee8f9f5a387ed683733d1f8d434357a31b138f..853480d2b3d1c21cd962a1834d96fa569be7e627 100644 (file)
@@ -318,11 +318,9 @@ static int cramfs_fill_super(struct super_block *sb, void *data, int silent)
        root = get_cramfs_inode(sb, &super.root, 0);
        if (IS_ERR(root))
                goto out;
-       sb->s_root = d_alloc_root(root);
-       if (!sb->s_root) {
-               iput(root);
+       sb->s_root = d_make_root(root);
+       if (!sb->s_root)
                goto out;
-       }
        return 0;
 out:
        kfree(sbi);
index c4e2a58a2e82fcd7edd8d0e5ba4bd4c0e4d03c45..57dae0baedf2573538d1a375d3563625b780527d 100644 (file)
@@ -309,12 +309,11 @@ devpts_fill_super(struct super_block *s, void *data, int silent)
        inode->i_fop = &simple_dir_operations;
        set_nlink(inode, 2);
 
-       s->s_root = d_alloc_root(inode);
+       s->s_root = d_make_root(inode);
        if (s->s_root)
                return 0;
 
        printk(KERN_ERR "devpts: get root dentry failed\n");
-       iput(inode);
 
 fail:
        return -ENOMEM;
index b4a6befb12168d6b0aa0bb7411794e062ded8734..6e0e017e693215c69250a8cfd8cd42c293f3f715 100644 (file)
@@ -550,9 +550,8 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags
        if (IS_ERR(inode))
                goto out_free;
 
-       s->s_root = d_alloc_root(inode);
+       s->s_root = d_make_root(inode);
        if (!s->s_root) {
-               iput(inode);
                rc = -ENOMEM;
                goto out_free;
        }
index 981106429a9fd85a192fd17685d9e9b8c22c8e44..e755ec746c6967ed12e9ea036ddcd83214770d48 100644 (file)
@@ -317,10 +317,9 @@ static int efs_fill_super(struct super_block *s, void *d, int silent)
                goto out_no_fs;
        }
 
-       s->s_root = d_alloc_root(root);
+       s->s_root = d_make_root(root);
        if (!(s->s_root)) {
                printk(KERN_ERR "EFS: get root dentry failed\n");
-               iput(root);
                ret = -ENOMEM;
                goto out_no_fs;
        }
index 6cafcadfc3c838506fb188768743cfcc2243975d..7f2b590a36b761182c9d4fa56b16f11ab7171ac9 100644 (file)
@@ -819,9 +819,8 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent)
                ret = PTR_ERR(root);
                goto free_sbi;
        }
-       sb->s_root = d_alloc_root(root);
+       sb->s_root = d_make_root(root);
        if (!sb->s_root) {
-               iput(root);
                EXOFS_ERR("ERROR: get root inode failed\n");
                ret = -ENOMEM;
                goto free_sbi;
index 9f6766a3ac1ed1cc38a5683c12a82fd75138ed31..e1025c7a437a730d9213bf689c63c68d6dcc1d76 100644 (file)
@@ -1088,9 +1088,8 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
                goto failed_mount3;
        }
 
-       sb->s_root = d_alloc_root(root);
+       sb->s_root = d_make_root(root);
        if (!sb->s_root) {
-               iput(root);
                ext2_msg(sb, KERN_ERR, "error: get root inode failed");
                ret = -ENOMEM;
                goto failed_mount3;
index 726c7ef6cdf129df3bd4da58e791919be7e1aeca..e0b45b93327ba1cdb668837b198c833f2a800d78 100644 (file)
@@ -2046,10 +2046,9 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
                ext3_msg(sb, KERN_ERR, "error: corrupt root inode, run e2fsck");
                goto failed_mount3;
        }
-       sb->s_root = d_alloc_root(root);
+       sb->s_root = d_make_root(root);
        if (!sb->s_root) {
                ext3_msg(sb, KERN_ERR, "error: get root dentry failed");
-               iput(root);
                ret = -ENOMEM;
                goto failed_mount3;
        }
index 502c61fd739262306f7665b355cbdeba4d1e1c43..d2baea7bcf30188f09abc1f28f91a4a5f71bfd65 100644 (file)
@@ -3735,9 +3735,8 @@ no_journal:
                iput(root);
                goto failed_mount4;
        }
-       sb->s_root = d_alloc_root(root);
+       sb->s_root = d_make_root(root);
        if (!sb->s_root) {
-               iput(root);
                ext4_msg(sb, KERN_ERR, "get root dentry failed");
                ret = -ENOMEM;
                goto failed_mount4;
index 9d1c99558389dabd0b11329ddcb51bcd4d9711f6..d4fabd26084ed8340e772e3699faa2e9e239da91 100644 (file)
@@ -224,9 +224,8 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent)
                ret = PTR_ERR(root);
                goto out;
        }
-       sbp->s_root = d_alloc_root(root);
+       sbp->s_root = d_make_root(root);
        if (!sbp->s_root) {
-               iput(root);
                printk(KERN_WARNING "vxfs: unable to get root dentry.\n");
                goto out_free_ilist;
        }
index 64cf8d07393e4e55d2101039525fbaa0a1008e35..4aec5995867e95c8c0df3e00d93b1e5ae39d25c0 100644 (file)
@@ -988,14 +988,9 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
 
        err = -ENOMEM;
        root = fuse_get_root_inode(sb, d.rootmode);
-       if (!root)
+       root_dentry = d_make_root(root);
+       if (!root_dentry)
                goto err_put_conn;
-
-       root_dentry = d_alloc_root(root);
-       if (!root_dentry) {
-               iput(root);
-               goto err_put_conn;
-       }
        /* only now - we want root dentry with NULL ->d_op */
        sb->s_d_op = &fuse_dentry_operations;
 
index 24f609c9ef911edb3b3cabc9dc98dc4a78e1b92d..10e848c6d1b56a1e9fdbb2ab2d814ad69c625217 100644 (file)
@@ -431,10 +431,9 @@ static int gfs2_lookup_root(struct super_block *sb, struct dentry **dptr,
                fs_err(sdp, "can't read in %s inode: %ld\n", name, PTR_ERR(inode));
                return PTR_ERR(inode);
        }
-       dentry = d_alloc_root(inode);
+       dentry = d_make_root(inode);
        if (!dentry) {
                fs_err(sdp, "can't alloc %s dentry\n", name);
-               iput(inode);
                return -ENOMEM;
        }
        *dptr = dentry;
index 8137fb3e6780343c6a7a36086547cdfba0936c0e..7b4c537d6e136b42fba064de39b0c57703b5fec3 100644 (file)
@@ -430,15 +430,13 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent)
 
        sb->s_d_op = &hfs_dentry_operations;
        res = -ENOMEM;
-       sb->s_root = d_alloc_root(root_inode);
+       sb->s_root = d_make_root(root_inode);
        if (!sb->s_root)
-               goto bail_iput;
+               goto bail_no_root;
 
        /* everything's okay */
        return 0;
 
-bail_iput:
-       iput(root_inode);
 bail_no_root:
        printk(KERN_ERR "hfs: get root inode failed.\n");
 bail:
index e130bd46d671515762152d071194ce9e9a3bb4a6..588d45885a6fb2b80d7bc6babf5290437636d6a8 100644 (file)
@@ -966,9 +966,9 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
        }
 
        err = -ENOMEM;
-       sb->s_root = d_alloc_root(root_inode);
+       sb->s_root = d_make_root(root_inode);
        if (sb->s_root == NULL)
-               goto out_put;
+               goto out;
 
        return 0;
 
index 3690467c944e0869dd32dff84c7a13644e36b1dd..54f6eccb79d9ed8c67f7ada5a96867ad4c61b37c 100644 (file)
@@ -625,11 +625,9 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
        hpfs_init_inode(root);
        hpfs_read_inode(root);
        unlock_new_inode(root);
-       s->s_root = d_alloc_root(root);
-       if (!s->s_root) {
-               iput(root);
+       s->s_root = d_make_root(root);
+       if (!s->s_root)
                goto bail0;
-       }
 
        /*
         * find the root directory's . pointer & finish filling in the inode
index d92f4ce809252c0da7af915b83b496211e65f4d5..a80e45a690ac9a07176319abefa3a8d83c906d3d 100644 (file)
@@ -726,17 +726,12 @@ static int hppfs_fill_super(struct super_block *sb, void *d, int silent)
 
        err = -ENOMEM;
        root_inode = get_inode(sb, dget(proc_mnt->mnt_root));
-       if (!root_inode)
-               goto out_mntput;
-
-       sb->s_root = d_alloc_root(root_inode);
+       sb->s_root = d_make_root(root_inode);
        if (!sb->s_root)
-               goto out_iput;
+               goto out_mntput;
 
        return 0;
 
- out_iput:
-       iput(root_inode);
  out_mntput:
        mntput(proc_mnt);
  out:
index 1e85a7ac021759da6a3ad118b5c1734db0bd1cc0..81932fa1861ae1a70e51dc105af411093afbe72e 100644 (file)
@@ -831,8 +831,6 @@ bad_val:
 static int
 hugetlbfs_fill_super(struct super_block *sb, void *data, int silent)
 {
-       struct inode * inode;
-       struct dentry * root;
        int ret;
        struct hugetlbfs_config config;
        struct hugetlbfs_sb_info *sbinfo;
@@ -865,16 +863,9 @@ hugetlbfs_fill_super(struct super_block *sb, void *data, int silent)
        sb->s_magic = HUGETLBFS_MAGIC;
        sb->s_op = &hugetlbfs_ops;
        sb->s_time_gran = 1;
-       inode = hugetlbfs_get_root(sb, &config);
-       if (!inode)
-               goto out_free;
-
-       root = d_alloc_root(inode);
-       if (!root) {
-               iput(inode);
+       sb->s_root = d_make_root(hugetlbfs_get_root(sb, &config));
+       if (!sb->s_root)
                goto out_free;
-       }
-       sb->s_root = root;
        return 0;
 out_free:
        kfree(sbinfo);
index bd62c76fb5df8a08d8d11bdae311ecc8a3054039..29037c365ba4f4807eca405680def2c78353f966 100644 (file)
@@ -947,9 +947,8 @@ root_found:
        s->s_d_op = &isofs_dentry_ops[table];
 
        /* get the root dentry */
-       s->s_root = d_alloc_root(inode);
+       s->s_root = d_make_root(inode);
        if (!(s->s_root)) {
-               iput(inode);
                error = -ENOMEM;
                goto out_no_inode;
        }
index 2e0123867cb1b67b1a6a88d9f03439af1da4c204..c0d5c9d770dadc8df1afbaaeaa5136813aa746ac 100644 (file)
@@ -561,9 +561,9 @@ int jffs2_do_fill_super(struct super_block *sb, void *data, int silent)
        ret = -ENOMEM;
 
        D1(printk(KERN_DEBUG "jffs2_do_fill_super(): d_alloc_root()\n"));
-       sb->s_root = d_alloc_root(root_i);
+       sb->s_root = d_make_root(root_i);
        if (!sb->s_root)
-               goto out_root_i;
+               goto out_root;
 
        sb->s_maxbytes = 0xFFFFFFFF;
        sb->s_blocksize = PAGE_CACHE_SIZE;
@@ -573,8 +573,6 @@ int jffs2_do_fill_super(struct super_block *sb, void *data, int silent)
                jffs2_start_garbage_collect_thread(c);
        return 0;
 
- out_root_i:
-       iput(root_i);
 out_root:
        jffs2_free_ino_caches(c);
        jffs2_free_raw_node_refs(c);
index 4661ad7051301d74314a76b44e9e61bdd089a9da..b3bb95504479d865ddc6d8ae9c9fd5cc627eed96 100644 (file)
@@ -522,7 +522,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
                ret = PTR_ERR(inode);
                goto out_no_rw;
        }
-       sb->s_root = d_alloc_root(inode);
+       sb->s_root = d_make_root(inode);
        if (!sb->s_root)
                goto out_no_root;
 
@@ -540,7 +540,6 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
 
 out_no_root:
        jfs_err("jfs_read_super: get root dentry failed");
-       iput(inode);
 
 out_no_rw:
        rc = jfs_umount(sb);
index 5b2dbb3ba4fca95f3aab72c39f570c16a61c5c02..7c895a763a1e6340e23488e49ea57811cd898d12 100644 (file)
@@ -491,11 +491,9 @@ int simple_fill_super(struct super_block *s, unsigned long magic,
        inode->i_op = &simple_dir_inode_operations;
        inode->i_fop = &simple_dir_operations;
        set_nlink(inode, 2);
-       root = d_alloc_root(inode);
-       if (!root) {
-               iput(inode);
+       root = d_make_root(inode);
+       if (!root)
                return -ENOMEM;
-       }
        for (i = 0; !files->name || files->name[0]; i++, files++) {
                if (!files->name)
                        continue;
index b1a491a5fe78a4bf899263e17c6a22c60015b870..7de18c3021febe108aa241543d90109962b448b0 100644 (file)
@@ -315,11 +315,9 @@ static int logfs_get_sb_final(struct super_block *sb)
        if (IS_ERR(rootdir))
                goto fail;
 
-       sb->s_root = d_alloc_root(rootdir);
-       if (!sb->s_root) {
-               iput(rootdir);
+       sb->s_root = d_make_root(rootdir);
+       if (!sb->s_root)
                goto fail;
-       }
 
        /* at that point we know that ->put_super() will be called */
        super->s_erase_page = alloc_pages(GFP_KERNEL, 0);
index 3d1e34f8a68e2b70a0cce3bc32321bf3ff3a1241..49df0e7f8379149c3f113506afdc5c8ee7db51a4 100644 (file)
@@ -716,13 +716,11 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
         if (!root_inode)
                goto out_disconnect;
        DPRINTK("ncp_fill_super: root vol=%d\n", NCP_FINFO(root_inode)->volNumber);
-       sb->s_root = d_alloc_root(root_inode);
+       sb->s_root = d_make_root(root_inode);
         if (!sb->s_root)
-               goto out_no_root;
+               goto out_disconnect;
        return 0;
 
-out_no_root:
-       iput(root_inode);
 out_disconnect:
        ncp_lock_server(server);
        ncp_disconnect(server);
index dcb61548887fdba13fc484c844aeb3a6b14a0fe9..801d6d830787cf03ce02b2c768d5b56049c120b6 100644 (file)
@@ -49,11 +49,9 @@ static int nfs_superblock_set_dummy_root(struct super_block *sb, struct inode *i
 {
        /* The mntroot acts as the dummy root dentry for this superblock */
        if (sb->s_root == NULL) {
-               sb->s_root = d_alloc_root(inode);
-               if (sb->s_root == NULL) {
-                       iput(inode);
+               sb->s_root = d_make_root(inode);
+               if (sb->s_root == NULL)
                        return -ENOMEM;
-               }
                ihold(inode);
                /*
                 * Ensure that this dentry is invisible to d_find_alias().
index 1fc9ad3c1d14707bdd2cf0349e3b1ea5cf7450a2..1099a76cee5962838841a9719a0758e4defcb2d3 100644 (file)
@@ -917,9 +917,8 @@ static int nilfs_get_root_dentry(struct super_block *sb,
        if (root->cno == NILFS_CPTREE_CURRENT_CNO) {
                dentry = d_find_alias(inode);
                if (!dentry) {
-                       dentry = d_alloc_root(inode);
+                       dentry = d_make_root(inode);
                        if (!dentry) {
-                               iput(inode);
                                ret = -ENOMEM;
                                goto failed_dentry;
                        }
index abfac0d7ae9c7a03621a922d7960a4ce22abd121..3b5825ef3193e31aed188eff90015dccd363c0d4 100644 (file)
@@ -582,24 +582,14 @@ static int dlmfs_fill_super(struct super_block * sb,
                            void * data,
                            int silent)
 {
-       struct inode * inode;
-       struct dentry * root;
-
        sb->s_maxbytes = MAX_LFS_FILESIZE;
        sb->s_blocksize = PAGE_CACHE_SIZE;
        sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
        sb->s_magic = DLMFS_MAGIC;
        sb->s_op = &dlmfs_ops;
-       inode = dlmfs_get_root_inode(sb);
-       if (!inode)
-               return -ENOMEM;
-
-       root = d_alloc_root(inode);
-       if (!root) {
-               iput(inode);
+       sb->s_root = d_make_root(dlmfs_get_root_inode(sb));
+       if (!sb->s_root)
                return -ENOMEM;
-       }
-       sb->s_root = root;
        return 0;
 }
 
index 2b1184f7097ff8458fd627f45cd1fe81476e7d0d..337687c3e233e0ccc2f09837b8e49df595f2b5ac 100644 (file)
@@ -1166,9 +1166,8 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
                goto read_super_error;
        }
 
-       root = d_alloc_root(inode);
+       root = d_make_root(inode);
        if (!root) {
-               iput(inode);
                status = -ENOMEM;
                mlog_errno(status);
                goto read_super_error;
index 6065bb0ba20747287547b2e5d68de0a20eddd215..dbc842222589fdaf87a45a76ec257761f49b2037 100644 (file)
@@ -539,11 +539,9 @@ static int omfs_fill_super(struct super_block *sb, void *data, int silent)
                goto out_brelse_bh2;
        }
 
-       sb->s_root = d_alloc_root(root);
-       if (!sb->s_root) {
-               iput(root);
+       sb->s_root = d_make_root(root);
+       if (!sb->s_root)
                goto out_brelse_bh2;
-       }
        printk(KERN_DEBUG "omfs: Mounted volume %s\n", omfs_rb->r_name);
 
        ret = 0;
index a88c03bc749d078f13f2a1cbda15c40b89795451..bc49c975d501bad147ee9ac64fdafc5579de6d01 100644 (file)
@@ -408,13 +408,12 @@ static int openprom_fill_super(struct super_block *s, void *data, int silent)
        oi->type = op_inode_node;
        oi->u.node = of_find_node_by_path("/");
 
-       s->s_root = d_alloc_root(root_inode);
+       s->s_root = d_make_root(root_inode);
        if (!s->s_root)
                goto out_no_root_dentry;
        return 0;
 
 out_no_root_dentry:
-       iput(root_inode);
        ret = -ENOMEM;
 out_no_root:
        printk("openprom_fill_super: get root inode failed\n");
index a70af3a44f45e913ed6d182a17d619d7df1c2b07..8461a7b82fdb5db92c058261abebb78812398f9c 100644 (file)
@@ -486,8 +486,6 @@ struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de)
 
 int proc_fill_super(struct super_block *s)
 {
-       struct inode * root_inode;
-
        s->s_flags |= MS_NODIRATIME | MS_NOSUID | MS_NOEXEC;
        s->s_blocksize = 1024;
        s->s_blocksize_bits = 10;
@@ -496,17 +494,10 @@ int proc_fill_super(struct super_block *s)
        s->s_time_gran = 1;
        
        pde_get(&proc_root);
-       root_inode = proc_get_inode(s, &proc_root);
-       if (!root_inode)
-               goto out_no_root;
-       s->s_root = d_alloc_root(root_inode);
-       if (!s->s_root) {
-               iput(root_inode);
-               goto out_no_root;
-       }
-       return 0;
+       s->s_root = d_make_root(proc_get_inode(s, &proc_root));
+       if (s->s_root)
+               return 0;
 
-out_no_root:
        printk("proc_read_super: get root inode failed\n");
        pde_put(&proc_root);
        return -ENOMEM;
index b3b426edb2fd7b341b8ab1940f891114e752615f..ec7d1fb6f35abd7b88e165ddd56b190411e7ad01 100644 (file)
@@ -303,7 +303,7 @@ int pstore_fill_super(struct super_block *sb, void *data, int silent)
        /* override ramfs "dir" options so we catch unlink(2) */
        inode->i_op = &pstore_dir_inode_operations;
 
-       root = d_alloc_root(inode);
+       root = d_make_root(inode);
        sb->s_root = root;
        if (!root) {
                err = -ENOMEM;
@@ -314,7 +314,6 @@ int pstore_fill_super(struct super_block *sb, void *data, int silent)
 
        return 0;
 fail:
-       iput(inode);
        return err;
 }
 
index 6b009548d2e0380dbbbd8c061570f2805371bf4d..db18d866d9818dff43032a34e8de6e84ab753668 100644 (file)
@@ -260,15 +260,13 @@ static int qnx4_fill_super(struct super_block *s, void *data, int silent)
        }
 
        ret = -ENOMEM;
-       s->s_root = d_alloc_root(root);
+       s->s_root = d_make_root(root);
        if (s->s_root == NULL)
-               goto outi;
+               goto outb;
 
        brelse(bh);
        return 0;
 
-      outi:
-       iput(root);
       outb:
        kfree(qs->BitMap);
       out:
index aec766abe3affdd34b4ccff46036ae2902950398..b6612d2ed718bdbc110560b7ef09bc7238446b3f 100644 (file)
@@ -210,7 +210,6 @@ int ramfs_fill_super(struct super_block *sb, void *data, int silent)
 {
        struct ramfs_fs_info *fsi;
        struct inode *inode = NULL;
-       struct dentry *root;
        int err;
 
        save_mount_options(sb, data);
@@ -234,14 +233,8 @@ int ramfs_fill_super(struct super_block *sb, void *data, int silent)
        sb->s_time_gran         = 1;
 
        inode = ramfs_get_inode(sb, NULL, S_IFDIR | fsi->mount_opts.mode, 0);
-       if (!inode) {
-               err = -ENOMEM;
-               goto fail;
-       }
-
-       root = d_alloc_root(inode);
-       sb->s_root = root;
-       if (!root) {
+       sb->s_root = d_make_root(inode);
+       if (!sb->s_root) {
                err = -ENOMEM;
                goto fail;
        }
@@ -250,7 +243,6 @@ int ramfs_fill_super(struct super_block *sb, void *data, int silent)
 fail:
        kfree(fsi);
        sb->s_fs_info = NULL;
-       iput(inode);
        return err;
 }
 
index e12d8b97cd4dbf3c4c7dc249d42c66a8aeadc4bb..208dfd14440980e1c4e6c0866ddd34c694656046 100644 (file)
@@ -1874,11 +1874,9 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
                unlock_new_inode(root_inode);
        }
 
-       s->s_root = d_alloc_root(root_inode);
-       if (!s->s_root) {
-               iput(root_inode);
+       s->s_root = d_make_root(root_inode);
+       if (!s->s_root)
                goto error;
-       }
        // define and initialize hash function
        sbi->s_hash_function = hash_function(s);
        if (sbi->s_hash_function == NULL) {
index bb36ab74eb452b60025f92a0bd7b81837890ec7f..e64f6b5f7ae57f72d636a4b7f3f5a2c2e3839202 100644 (file)
@@ -538,14 +538,12 @@ static int romfs_fill_super(struct super_block *sb, void *data, int silent)
        if (IS_ERR(root))
                goto error;
 
-       sb->s_root = d_alloc_root(root);
+       sb->s_root = d_make_root(root);
        if (!sb->s_root)
-               goto error_i;
+               goto error;
 
        return 0;
 
-error_i:
-       iput(root);
 error:
        return -EINVAL;
 error_rsb_inval:
index ecaa2f7bdb8f16ebac1a00896cc9d1a870351788..970b1167e7cbda4e106abeb9e574da2726401906 100644 (file)
@@ -316,11 +316,10 @@ check_directory_table:
        }
        insert_inode_hash(root);
 
-       sb->s_root = d_alloc_root(root);
+       sb->s_root = d_make_root(root);
        if (sb->s_root == NULL) {
                ERROR("Root inode create failed\n");
                err = -ENOMEM;
-               iput(root);
                goto failed_mount;
        }
 
index e34f0d99ea4ec5a7b3361b1fc0cd02fad2d23410..2243f8ec64d5def01087548f839062a423567f08 100644 (file)
@@ -61,10 +61,9 @@ static int sysfs_fill_super(struct super_block *sb, void *data, int silent)
        }
 
        /* instantiate and link root dentry */
-       root = d_alloc_root(inode);
+       root = d_make_root(inode);
        if (!root) {
                pr_debug("%s: could not get root dentry!\n",__func__);
-               iput(inode);
                return -ENOMEM;
        }
        root->d_fsdata = &sysfs_root;
index f467740e088c2958a6867e9794ad3fb69bd892ab..7491c33b6468738522b519f729d58f80de002859 100644 (file)
@@ -341,9 +341,8 @@ static int complete_read_super(struct super_block *sb, int silent, int size)
                printk("SysV FS: get root inode failed\n");
                return 0;
        }
-       sb->s_root = d_alloc_root(root_inode);
+       sb->s_root = d_make_root(root_inode);
        if (!sb->s_root) {
-               iput(root_inode);
                printk("SysV FS: get root dentry failed\n");
                return 0;
        }
index 63765d58445b61e7b871e7e1722fedd1668a23b9..76e4e0566ad6c260069a87f56c253f7e9a17727b 100644 (file)
@@ -2076,15 +2076,13 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent)
                goto out_umount;
        }
 
-       sb->s_root = d_alloc_root(root);
+       sb->s_root = d_make_root(root);
        if (!sb->s_root)
-               goto out_iput;
+               goto out_umount;
 
        mutex_unlock(&c->umount_mutex);
        return 0;
 
-out_iput:
-       iput(root);
 out_umount:
        ubifs_umount(c);
 out_unlock:
index 8d8b25336fbbd88ee8a2f836bf6a893fcfc905a3..85067b4c7e144d743e23fc0de7602470ffe367f9 100644 (file)
@@ -2037,10 +2037,9 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
        }
 
        /* Allocate a dentry for the root inode */
-       sb->s_root = d_alloc_root(inode);
+       sb->s_root = d_make_root(inode);
        if (!sb->s_root) {
                udf_err(sb, "Couldn't allocate root dentry\n");
-               iput(inode);
                goto error_out;
        }
        sb->s_maxbytes = MAX_LFS_FILESIZE;
index ec25d09fcaa837150a43613b2224daeb8ba7dcb7..f636f6b460d0be3337870073793b467ed15c9429 100644 (file)
@@ -1164,10 +1164,10 @@ magic_found:
                ret = PTR_ERR(inode);
                goto failed;
        }
-       sb->s_root = d_alloc_root(inode);
+       sb->s_root = d_make_root(inode);
        if (!sb->s_root) {
                ret = -ENOMEM;
-               goto dalloc_failed;
+               goto failed;
        }
 
        ufs_setup_cstotal(sb);
@@ -1181,8 +1181,6 @@ magic_found:
        UFSD("EXIT\n");
        return 0;
 
-dalloc_failed:
-       iput(inode);
 failed:
        if (ubh)
                ubh_brelse_uspi (uspi);
index 0e4c5c017fbaa95238de5f8a0ff830c0a6f8d112..baf40e378d35372e7f8c7f99f62b9a02767b3153 100644 (file)
@@ -1362,10 +1362,10 @@ xfs_fs_fill_super(
                error = EINVAL;
                goto out_syncd_stop;
        }
-       sb->s_root = d_alloc_root(root);
+       sb->s_root = d_make_root(root);
        if (!sb->s_root) {
                error = ENOMEM;
-               goto out_iput;
+               goto out_syncd_stop;
        }
 
        return 0;
@@ -1384,8 +1384,6 @@ xfs_fs_fill_super(
  out:
        return -error;
 
- out_iput:
-       iput(root);
  out_syncd_stop:
        xfs_syncd_stop(mp);
  out_unmount:
index 86ee272de210bbae8236d45a4cebda3021afe2e9..28bd64ddeda3f438742d5297e13da0269ad62609 100644 (file)
@@ -188,30 +188,20 @@ static int mqueue_fill_super(struct super_block *sb, void *data, int silent)
 {
        struct inode *inode;
        struct ipc_namespace *ns = data;
-       int error;
 
        sb->s_blocksize = PAGE_CACHE_SIZE;
        sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
        sb->s_magic = MQUEUE_MAGIC;
        sb->s_op = &mqueue_super_ops;
 
-       inode = mqueue_get_inode(sb, ns, S_IFDIR | S_ISVTX | S_IRWXUGO,
-                               NULL);
-       if (IS_ERR(inode)) {
-               error = PTR_ERR(inode);
-               goto out;
-       }
+       inode = mqueue_get_inode(sb, ns, S_IFDIR | S_ISVTX | S_IRWXUGO, NULL);
+       if (IS_ERR(inode))
+               return PTR_ERR(inode);
 
-       sb->s_root = d_alloc_root(inode);
-       if (!sb->s_root) {
-               iput(inode);
-               error = -ENOMEM;
-               goto out;
-       }
-       error = 0;
-
-out:
-       return error;
+       sb->s_root = d_make_root(inode);
+       if (!sb->s_root)
+               return -ENOMEM;
+       return 0;
 }
 
 static struct dentry *mqueue_mount(struct file_system_type *fs_type,
index a5d3b5325f770f5347c7bdd1dca37baad1572126..711c1a30ceaa1895665dad7e86f71a2234d99b11 100644 (file)
@@ -1472,7 +1472,6 @@ static int cgroup_get_rootdir(struct super_block *sb)
 
        struct inode *inode =
                cgroup_new_inode(S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR, sb);
-       struct dentry *dentry;
 
        if (!inode)
                return -ENOMEM;
@@ -1481,12 +1480,9 @@ static int cgroup_get_rootdir(struct super_block *sb)
        inode->i_op = &cgroup_dir_inode_operations;
        /* directories start off with i_nlink == 2 (for "." entry) */
        inc_nlink(inode);
-       dentry = d_alloc_root(inode);
-       if (!dentry) {
-               iput(inode);
+       sb->s_root = d_make_root(inode);
+       if (!sb->s_root)
                return -ENOMEM;
-       }
-       sb->s_root = dentry;
        /* for everything else we want ->d_op set */
        sb->s_d_op = &cgroup_dops;
        return 0;
index 269d049294abca49b518f158ef7e65fd7cb2547e..154243f0a27c5d88c31fc8426f96ff0867345322 100644 (file)
@@ -2232,14 +2232,12 @@ int shmem_fill_super(struct super_block *sb, void *data, int silent)
                goto failed;
        inode->i_uid = sbinfo->uid;
        inode->i_gid = sbinfo->gid;
-       root = d_alloc_root(inode);
+       root = d_make_root(inode);
        if (!root)
-               goto failed_iput;
+               goto failed;
        sb->s_root = root;
        return 0;
 
-failed_iput:
-       iput(inode);
 failed:
        shmem_put_super(sb);
        return err;
index 63a7a7add21eda6d0a2da4426e1156d6bdf77523..7d6dd6efbdbe33020985ebccc4cad492f867f475 100644 (file)
@@ -1033,13 +1033,9 @@ rpc_fill_super(struct super_block *sb, void *data, int silent)
        sb->s_time_gran = 1;
 
        inode = rpc_get_inode(sb, S_IFDIR | 0755);
-       if (!inode)
-               return -ENOMEM;
-       sb->s_root = root = d_alloc_root(inode);
-       if (!root) {
-               iput(inode);
+       sb->s_root = root = d_make_root(inode);
+       if (!root)
                return -ENOMEM;
-       }
        if (rpc_populate(root, files, RPCAUTH_lockd, RPCAUTH_RootEOF, NULL))
                return -ENOMEM;
        return 0;