aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-01-08 22:15:13 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2012-03-20 21:29:35 -0400
commit48fde701aff662559b38d9a609574068f22d00fe (patch)
treeaa6b203dc671b51d58575b65eb08310ff8309b60
parent6b4231e2f92adbcf96fb2a3fa751d7ca0a61b21f (diff)
switch open-coded instances of d_make_root() to new helper
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c4
-rw-r--r--arch/s390/hypfs/inode.c6
-rw-r--r--drivers/misc/ibmasm/ibmasmfs.c6
-rw-r--r--drivers/oprofile/oprofilefs.c6
-rw-r--r--drivers/usb/core/inode.c9
-rw-r--r--drivers/usb/gadget/f_fs.c8
-rw-r--r--drivers/usb/gadget/inode.c4
-rw-r--r--fs/9p/vfs_super.c3
-rw-r--r--fs/adfs/super.c3
-rw-r--r--fs/affs/super.c7
-rw-r--r--fs/afs/super.c7
-rw-r--r--fs/autofs4/inode.c10
-rw-r--r--fs/befs/linuxvfs.c3
-rw-r--r--fs/bfs/inode.c3
-rw-r--r--fs/btrfs/super.c8
-rw-r--r--fs/ceph/super.c3
-rw-r--r--fs/cifs/cifsfs.c4
-rw-r--r--fs/coda/inode.c3
-rw-r--r--fs/configfs/mount.c3
-rw-r--r--fs/cramfs/inode.c6
-rw-r--r--fs/devpts/inode.c3
-rw-r--r--fs/ecryptfs/main.c3
-rw-r--r--fs/efs/super.c3
-rw-r--r--fs/exofs/super.c3
-rw-r--r--fs/ext2/super.c3
-rw-r--r--fs/ext3/super.c3
-rw-r--r--fs/ext4/super.c3
-rw-r--r--fs/freevxfs/vxfs_super.c3
-rw-r--r--fs/fuse/inode.c9
-rw-r--r--fs/gfs2/ops_fstype.c3
-rw-r--r--fs/hfs/super.c6
-rw-r--r--fs/hostfs/hostfs_kern.c4
-rw-r--r--fs/hpfs/super.c6
-rw-r--r--fs/hppfs/hppfs.c9
-rw-r--r--fs/hugetlbfs/inode.c13
-rw-r--r--fs/isofs/inode.c3
-rw-r--r--fs/jffs2/fs.c6
-rw-r--r--fs/jfs/super.c3
-rw-r--r--fs/libfs.c6
-rw-r--r--fs/logfs/super.c6
-rw-r--r--fs/ncpfs/inode.c6
-rw-r--r--fs/nfs/getroot.c6
-rw-r--r--fs/nilfs2/super.c3
-rw-r--r--fs/ocfs2/dlmfs/dlmfs.c14
-rw-r--r--fs/ocfs2/super.c3
-rw-r--r--fs/omfs/inode.c6
-rw-r--r--fs/openpromfs/inode.c3
-rw-r--r--fs/proc/inode.c15
-rw-r--r--fs/pstore/inode.c3
-rw-r--r--fs/qnx4/inode.c6
-rw-r--r--fs/ramfs/inode.c12
-rw-r--r--fs/reiserfs/super.c6
-rw-r--r--fs/romfs/super.c6
-rw-r--r--fs/squashfs/super.c3
-rw-r--r--fs/sysfs/mount.c3
-rw-r--r--fs/sysv/super.c3
-rw-r--r--fs/ubifs/super.c6
-rw-r--r--fs/udf/super.c3
-rw-r--r--fs/ufs/super.c6
-rw-r--r--fs/xfs/xfs_super.c6
-rw-r--r--ipc/mqueue.c24
-rw-r--r--kernel/cgroup.c8
-rw-r--r--mm/shmem.c6
-rw-r--r--net/sunrpc/rpc_pipe.c8
64 files changed, 105 insertions, 264 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index d4a094ca96f3..17b3211e3641 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -757,9 +757,9 @@ spufs_create_root(struct super_block *sb, void *data)
757 goto out_iput; 757 goto out_iput;
758 758
759 ret = -ENOMEM; 759 ret = -ENOMEM;
760 sb->s_root = d_alloc_root(inode); 760 sb->s_root = d_make_root(inode);
761 if (!sb->s_root) 761 if (!sb->s_root)
762 goto out_iput; 762 goto out;
763 763
764 return 0; 764 return 0;
765out_iput: 765out_iput:
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
index 8a2a887478cc..6a2cb560e968 100644
--- a/arch/s390/hypfs/inode.c
+++ b/arch/s390/hypfs/inode.c
@@ -293,11 +293,9 @@ static int hypfs_fill_super(struct super_block *sb, void *data, int silent)
293 return -ENOMEM; 293 return -ENOMEM;
294 root_inode->i_op = &simple_dir_inode_operations; 294 root_inode->i_op = &simple_dir_inode_operations;
295 root_inode->i_fop = &simple_dir_operations; 295 root_inode->i_fop = &simple_dir_operations;
296 sb->s_root = root_dentry = d_alloc_root(root_inode); 296 sb->s_root = root_dentry = d_make_root(root_inode);
297 if (!root_dentry) { 297 if (!root_dentry)
298 iput(root_inode);
299 return -ENOMEM; 298 return -ENOMEM;
300 }
301 if (MACHINE_IS_VM) 299 if (MACHINE_IS_VM)
302 rc = hypfs_vm_create_files(sb, root_dentry); 300 rc = hypfs_vm_create_files(sb, root_dentry);
303 else 301 else
diff --git a/drivers/misc/ibmasm/ibmasmfs.c b/drivers/misc/ibmasm/ibmasmfs.c
index 35361753b487..15f24f362208 100644
--- a/drivers/misc/ibmasm/ibmasmfs.c
+++ b/drivers/misc/ibmasm/ibmasmfs.c
@@ -129,11 +129,9 @@ static int ibmasmfs_fill_super (struct super_block *sb, void *data, int silent)
129 root->i_op = &simple_dir_inode_operations; 129 root->i_op = &simple_dir_inode_operations;
130 root->i_fop = ibmasmfs_dir_ops; 130 root->i_fop = ibmasmfs_dir_ops;
131 131
132 root_dentry = d_alloc_root(root); 132 root_dentry = d_make_root(root);
133 if (!root_dentry) { 133 if (!root_dentry)
134 iput(root);
135 return -ENOMEM; 134 return -ENOMEM;
136 }
137 sb->s_root = root_dentry; 135 sb->s_root = root_dentry;
138 136
139 ibmasmfs_create_files(sb, root_dentry); 137 ibmasmfs_create_files(sb, root_dentry);
diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c
index 2f0aa0f700e6..277bb70b8d75 100644
--- a/drivers/oprofile/oprofilefs.c
+++ b/drivers/oprofile/oprofilefs.c
@@ -251,11 +251,9 @@ static int oprofilefs_fill_super(struct super_block *sb, void *data, int silent)
251 return -ENOMEM; 251 return -ENOMEM;
252 root_inode->i_op = &simple_dir_inode_operations; 252 root_inode->i_op = &simple_dir_inode_operations;
253 root_inode->i_fop = &simple_dir_operations; 253 root_inode->i_fop = &simple_dir_operations;
254 root_dentry = d_alloc_root(root_inode); 254 root_dentry = d_make_root(root_inode);
255 if (!root_dentry) { 255 if (!root_dentry)
256 iput(root_inode);
257 return -ENOMEM; 256 return -ENOMEM;
258 }
259 257
260 sb->s_root = root_dentry; 258 sb->s_root = root_dentry;
261 259
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c
index 9e186f3da839..bdaef8e36020 100644
--- a/drivers/usb/core/inode.c
+++ b/drivers/usb/core/inode.c
@@ -462,16 +462,9 @@ static int usbfs_fill_super(struct super_block *sb, void *data, int silent)
462 sb->s_op = &usbfs_ops; 462 sb->s_op = &usbfs_ops;
463 sb->s_time_gran = 1; 463 sb->s_time_gran = 1;
464 inode = usbfs_get_inode(sb, S_IFDIR | 0755, 0); 464 inode = usbfs_get_inode(sb, S_IFDIR | 0755, 0);
465 465 root = d_make_root(inode);
466 if (!inode) {
467 dbg("%s: could not get inode!",__func__);
468 return -ENOMEM;
469 }
470
471 root = d_alloc_root(inode);
472 if (!root) { 466 if (!root) {
473 dbg("%s: could not get root dentry!",__func__); 467 dbg("%s: could not get root dentry!",__func__);
474 iput(inode);
475 return -ENOMEM; 468 return -ENOMEM;
476 } 469 }
477 sb->s_root = root; 470 sb->s_root = root;
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
index f63dc6c150d2..d825b248728a 100644
--- a/drivers/usb/gadget/f_fs.c
+++ b/drivers/usb/gadget/f_fs.c
@@ -1063,13 +1063,9 @@ static int ffs_sb_fill(struct super_block *sb, void *_data, int silent)
1063 &simple_dir_operations, 1063 &simple_dir_operations,
1064 &simple_dir_inode_operations, 1064 &simple_dir_inode_operations,
1065 &data->perms); 1065 &data->perms);
1066 if (unlikely(!inode)) 1066 sb->s_root = d_make_root(inode);
1067 if (unlikely(!sb->s_root))
1067 goto Enomem; 1068 goto Enomem;
1068 sb->s_root = d_alloc_root(inode);
1069 if (unlikely(!sb->s_root)) {
1070 iput(inode);
1071 goto Enomem;
1072 }
1073 1069
1074 /* EP0 file */ 1070 /* EP0 file */
1075 if (unlikely(!ffs_sb_create_file(sb, "ep0", ffs, 1071 if (unlikely(!ffs_sb_create_file(sb, "ep0", ffs,
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
index ae04266dba1b..c95eea43b637 100644
--- a/drivers/usb/gadget/inode.c
+++ b/drivers/usb/gadget/inode.c
@@ -2059,10 +2059,8 @@ gadgetfs_fill_super (struct super_block *sb, void *opts, int silent)
2059 if (!inode) 2059 if (!inode)
2060 goto Enomem; 2060 goto Enomem;
2061 inode->i_op = &simple_dir_inode_operations; 2061 inode->i_op = &simple_dir_inode_operations;
2062 if (!(sb->s_root = d_alloc_root (inode))) { 2062 if (!(sb->s_root = d_make_root (inode)))
2063 iput(inode);
2064 goto Enomem; 2063 goto Enomem;
2065 }
2066 2064
2067 /* the ep0 file is named after the controller we expect; 2065 /* the ep0 file is named after the controller we expect;
2068 * user mode code can use it for sanity checks, like we do. 2066 * user mode code can use it for sanity checks, like we do.
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
index 7b0cd87b07c2..10b7d3c9dba8 100644
--- a/fs/9p/vfs_super.c
+++ b/fs/9p/vfs_super.c
@@ -155,9 +155,8 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags,
155 goto release_sb; 155 goto release_sb;
156 } 156 }
157 157
158 root = d_alloc_root(inode); 158 root = d_make_root(inode);
159 if (!root) { 159 if (!root) {
160 iput(inode);
161 retval = -ENOMEM; 160 retval = -ENOMEM;
162 goto release_sb; 161 goto release_sb;
163 } 162 }
diff --git a/fs/adfs/super.c b/fs/adfs/super.c
index 8e3b36ace305..06fdcc9382c4 100644
--- a/fs/adfs/super.c
+++ b/fs/adfs/super.c
@@ -483,10 +483,9 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)
483 483
484 sb->s_d_op = &adfs_dentry_operations; 484 sb->s_d_op = &adfs_dentry_operations;
485 root = adfs_iget(sb, &root_obj); 485 root = adfs_iget(sb, &root_obj);
486 sb->s_root = d_alloc_root(root); 486 sb->s_root = d_make_root(root);
487 if (!sb->s_root) { 487 if (!sb->s_root) {
488 int i; 488 int i;
489 iput(root);
490 for (i = 0; i < asb->s_map_size; i++) 489 for (i = 0; i < asb->s_map_size; i++)
491 brelse(asb->s_map[i].dm_bh); 490 brelse(asb->s_map[i].dm_bh);
492 kfree(asb->s_map); 491 kfree(asb->s_map);
diff --git a/fs/affs/super.c b/fs/affs/super.c
index 8ba73fed7964..0782653a05a2 100644
--- a/fs/affs/super.c
+++ b/fs/affs/super.c
@@ -473,7 +473,7 @@ got_root:
473 root_inode = affs_iget(sb, root_block); 473 root_inode = affs_iget(sb, root_block);
474 if (IS_ERR(root_inode)) { 474 if (IS_ERR(root_inode)) {
475 ret = PTR_ERR(root_inode); 475 ret = PTR_ERR(root_inode);
476 goto out_error_noinode; 476 goto out_error;
477 } 477 }
478 478
479 if (AFFS_SB(sb)->s_flags & SF_INTL) 479 if (AFFS_SB(sb)->s_flags & SF_INTL)
@@ -481,7 +481,7 @@ got_root:
481 else 481 else
482 sb->s_d_op = &affs_dentry_operations; 482 sb->s_d_op = &affs_dentry_operations;
483 483
484 sb->s_root = d_alloc_root(root_inode); 484 sb->s_root = d_make_root(root_inode);
485 if (!sb->s_root) { 485 if (!sb->s_root) {
486 printk(KERN_ERR "AFFS: Get root inode failed\n"); 486 printk(KERN_ERR "AFFS: Get root inode failed\n");
487 goto out_error; 487 goto out_error;
@@ -494,9 +494,6 @@ got_root:
494 * Begin the cascaded cleanup ... 494 * Begin the cascaded cleanup ...
495 */ 495 */
496out_error: 496out_error:
497 if (root_inode)
498 iput(root_inode);
499out_error_noinode:
500 kfree(sbi->s_bitmap); 497 kfree(sbi->s_bitmap);
501 affs_brelse(root_bh); 498 affs_brelse(root_bh);
502 kfree(sbi->s_prefix); 499 kfree(sbi->s_prefix);
diff --git a/fs/afs/super.c b/fs/afs/super.c
index 983ec59fc80d..f02b31e7e648 100644
--- a/fs/afs/super.c
+++ b/fs/afs/super.c
@@ -301,7 +301,6 @@ static int afs_fill_super(struct super_block *sb,
301{ 301{
302 struct afs_super_info *as = sb->s_fs_info; 302 struct afs_super_info *as = sb->s_fs_info;
303 struct afs_fid fid; 303 struct afs_fid fid;
304 struct dentry *root = NULL;
305 struct inode *inode = NULL; 304 struct inode *inode = NULL;
306 int ret; 305 int ret;
307 306
@@ -327,18 +326,16 @@ static int afs_fill_super(struct super_block *sb,
327 set_bit(AFS_VNODE_AUTOCELL, &AFS_FS_I(inode)->flags); 326 set_bit(AFS_VNODE_AUTOCELL, &AFS_FS_I(inode)->flags);
328 327
329 ret = -ENOMEM; 328 ret = -ENOMEM;
330 root = d_alloc_root(inode); 329 sb->s_root = d_make_root(inode);
331 if (!root) 330 if (!sb->s_root)
332 goto error; 331 goto error;
333 332
334 sb->s_d_op = &afs_fs_dentry_operations; 333 sb->s_d_op = &afs_fs_dentry_operations;
335 sb->s_root = root;
336 334
337 _leave(" = 0"); 335 _leave(" = 0");
338 return 0; 336 return 0;
339 337
340error: 338error:
341 iput(inode);
342 _leave(" = %d", ret); 339 _leave(" = %d", ret);
343 return ret; 340 return ret;
344} 341}
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
index 06858d955120..d8dc002e9cc3 100644
--- a/fs/autofs4/inode.c
+++ b/fs/autofs4/inode.c
@@ -247,12 +247,9 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
247 if (!ino) 247 if (!ino)
248 goto fail_free; 248 goto fail_free;
249 root_inode = autofs4_get_inode(s, S_IFDIR | 0755); 249 root_inode = autofs4_get_inode(s, S_IFDIR | 0755);
250 if (!root_inode) 250 root = d_make_root(root_inode);
251 goto fail_ino;
252
253 root = d_alloc_root(root_inode);
254 if (!root) 251 if (!root)
255 goto fail_iput; 252 goto fail_ino;
256 pipe = NULL; 253 pipe = NULL;
257 254
258 root->d_fsdata = ino; 255 root->d_fsdata = ino;
@@ -317,9 +314,6 @@ fail_fput:
317fail_dput: 314fail_dput:
318 dput(root); 315 dput(root);
319 goto fail_free; 316 goto fail_free;
320fail_iput:
321 printk("autofs: get root dentry failed\n");
322 iput(root_inode);
323fail_ino: 317fail_ino:
324 kfree(ino); 318 kfree(ino);
325fail_free: 319fail_free:
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index 6e6d536767fe..e18da23d42b5 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -852,9 +852,8 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
852 ret = PTR_ERR(root); 852 ret = PTR_ERR(root);
853 goto unacquire_priv_sbp; 853 goto unacquire_priv_sbp;
854 } 854 }
855 sb->s_root = d_alloc_root(root); 855 sb->s_root = d_make_root(root);
856 if (!sb->s_root) { 856 if (!sb->s_root) {
857 iput(root);
858 befs_error(sb, "get root inode failed"); 857 befs_error(sb, "get root inode failed");
859 goto unacquire_priv_sbp; 858 goto unacquire_priv_sbp;
860 } 859 }
diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
index b0391bc402b1..e23dc7c8b884 100644
--- a/fs/bfs/inode.c
+++ b/fs/bfs/inode.c
@@ -367,9 +367,8 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
367 ret = PTR_ERR(inode); 367 ret = PTR_ERR(inode);
368 goto out2; 368 goto out2;
369 } 369 }
370 s->s_root = d_alloc_root(inode); 370 s->s_root = d_make_root(inode);
371 if (!s->s_root) { 371 if (!s->s_root) {
372 iput(inode);
373 ret = -ENOMEM; 372 ret = -ENOMEM;
374 goto out2; 373 goto out2;
375 } 374 }
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 3ce97b217cbe..81df3fec6a6d 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -629,7 +629,6 @@ static int btrfs_fill_super(struct super_block *sb,
629 void *data, int silent) 629 void *data, int silent)
630{ 630{
631 struct inode *inode; 631 struct inode *inode;
632 struct dentry *root_dentry;
633 struct btrfs_fs_info *fs_info = btrfs_sb(sb); 632 struct btrfs_fs_info *fs_info = btrfs_sb(sb);
634 struct btrfs_key key; 633 struct btrfs_key key;
635 int err; 634 int err;
@@ -660,15 +659,12 @@ static int btrfs_fill_super(struct super_block *sb,
660 goto fail_close; 659 goto fail_close;
661 } 660 }
662 661
663 root_dentry = d_alloc_root(inode); 662 sb->s_root = d_make_root(inode);
664 if (!root_dentry) { 663 if (!sb->s_root) {
665 iput(inode);
666 err = -ENOMEM; 664 err = -ENOMEM;
667 goto fail_close; 665 goto fail_close;
668 } 666 }
669 667
670 sb->s_root = root_dentry;
671
672 save_mount_options(sb, data); 668 save_mount_options(sb, data);
673 cleancache_init_fs(sb); 669 cleancache_init_fs(sb);
674 sb->s_flags |= MS_ACTIVE; 670 sb->s_flags |= MS_ACTIVE;
diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index 00de2c9568cd..256f85221926 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -655,9 +655,8 @@ static struct dentry *open_root_dentry(struct ceph_fs_client *fsc,
655 dout("open_root_inode success\n"); 655 dout("open_root_inode success\n");
656 if (ceph_ino(inode) == CEPH_INO_ROOT && 656 if (ceph_ino(inode) == CEPH_INO_ROOT &&
657 fsc->sb->s_root == NULL) { 657 fsc->sb->s_root == NULL) {
658 root = d_alloc_root(inode); 658 root = d_make_root(inode);
659 if (!root) { 659 if (!root) {
660 iput(inode);
661 root = ERR_PTR(-ENOMEM); 660 root = ERR_PTR(-ENOMEM);
662 goto out; 661 goto out;
663 } 662 }
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 8b7d7ff88792..418fc42fb8b2 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -122,11 +122,9 @@ cifs_read_super(struct super_block *sb)
122 goto out_no_root; 122 goto out_no_root;
123 } 123 }
124 124
125 sb->s_root = d_alloc_root(inode); 125 sb->s_root = d_make_root(inode);
126
127 if (!sb->s_root) { 126 if (!sb->s_root) {
128 rc = -ENOMEM; 127 rc = -ENOMEM;
129 iput(inode);
130 goto out_no_root; 128 goto out_no_root;
131 } 129 }
132 130
diff --git a/fs/coda/inode.c b/fs/coda/inode.c
index 32dafc875c14..05156c17b551 100644
--- a/fs/coda/inode.c
+++ b/fs/coda/inode.c
@@ -213,9 +213,8 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent)
213 213
214 printk("coda_read_super: rootinode is %ld dev %s\n", 214 printk("coda_read_super: rootinode is %ld dev %s\n",
215 root->i_ino, root->i_sb->s_id); 215 root->i_ino, root->i_sb->s_id);
216 sb->s_root = d_alloc_root(root); 216 sb->s_root = d_make_root(root);
217 if (!sb->s_root) { 217 if (!sb->s_root) {
218 iput(root);
219 error = -EINVAL; 218 error = -EINVAL;
220 goto error; 219 goto error;
221 } 220 }
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c
index 276e15cafd58..07f60455f1c1 100644
--- a/fs/configfs/mount.c
+++ b/fs/configfs/mount.c
@@ -91,10 +91,9 @@ static int configfs_fill_super(struct super_block *sb, void *data, int silent)
91 return -ENOMEM; 91 return -ENOMEM;
92 } 92 }
93 93
94 root = d_alloc_root(inode); 94 root = d_make_root(inode);
95 if (!root) { 95 if (!root) {
96 pr_debug("%s: could not get root dentry!\n",__func__); 96 pr_debug("%s: could not get root dentry!\n",__func__);
97 iput(inode);
98 return -ENOMEM; 97 return -ENOMEM;
99 } 98 }
100 config_group_init(&configfs_root_group); 99 config_group_init(&configfs_root_group);
diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c
index a2ee8f9f5a38..853480d2b3d1 100644
--- a/fs/cramfs/inode.c
+++ b/fs/cramfs/inode.c
@@ -318,11 +318,9 @@ static int cramfs_fill_super(struct super_block *sb, void *data, int silent)
318 root = get_cramfs_inode(sb, &super.root, 0); 318 root = get_cramfs_inode(sb, &super.root, 0);
319 if (IS_ERR(root)) 319 if (IS_ERR(root))
320 goto out; 320 goto out;
321 sb->s_root = d_alloc_root(root); 321 sb->s_root = d_make_root(root);
322 if (!sb->s_root) { 322 if (!sb->s_root)
323 iput(root);
324 goto out; 323 goto out;
325 }
326 return 0; 324 return 0;
327out: 325out:
328 kfree(sbi); 326 kfree(sbi);
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index c4e2a58a2e82..57dae0baedf2 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -309,12 +309,11 @@ devpts_fill_super(struct super_block *s, void *data, int silent)
309 inode->i_fop = &simple_dir_operations; 309 inode->i_fop = &simple_dir_operations;
310 set_nlink(inode, 2); 310 set_nlink(inode, 2);
311 311
312 s->s_root = d_alloc_root(inode); 312 s->s_root = d_make_root(inode);
313 if (s->s_root) 313 if (s->s_root)
314 return 0; 314 return 0;
315 315
316 printk(KERN_ERR "devpts: get root dentry failed\n"); 316 printk(KERN_ERR "devpts: get root dentry failed\n");
317 iput(inode);
318 317
319fail: 318fail:
320 return -ENOMEM; 319 return -ENOMEM;
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index b4a6befb1216..6e0e017e6932 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -550,9 +550,8 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags
550 if (IS_ERR(inode)) 550 if (IS_ERR(inode))
551 goto out_free; 551 goto out_free;
552 552
553 s->s_root = d_alloc_root(inode); 553 s->s_root = d_make_root(inode);
554 if (!s->s_root) { 554 if (!s->s_root) {
555 iput(inode);
556 rc = -ENOMEM; 555 rc = -ENOMEM;
557 goto out_free; 556 goto out_free;
558 } 557 }
diff --git a/fs/efs/super.c b/fs/efs/super.c
index 981106429a9f..e755ec746c69 100644
--- a/fs/efs/super.c
+++ b/fs/efs/super.c
@@ -317,10 +317,9 @@ static int efs_fill_super(struct super_block *s, void *d, int silent)
317 goto out_no_fs; 317 goto out_no_fs;
318 } 318 }
319 319
320 s->s_root = d_alloc_root(root); 320 s->s_root = d_make_root(root);
321 if (!(s->s_root)) { 321 if (!(s->s_root)) {
322 printk(KERN_ERR "EFS: get root dentry failed\n"); 322 printk(KERN_ERR "EFS: get root dentry failed\n");
323 iput(root);
324 ret = -ENOMEM; 323 ret = -ENOMEM;
325 goto out_no_fs; 324 goto out_no_fs;
326 } 325 }
diff --git a/fs/exofs/super.c b/fs/exofs/super.c
index 6cafcadfc3c8..7f2b590a36b7 100644
--- a/fs/exofs/super.c
+++ b/fs/exofs/super.c
@@ -819,9 +819,8 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent)
819 ret = PTR_ERR(root); 819 ret = PTR_ERR(root);
820 goto free_sbi; 820 goto free_sbi;
821 } 821 }
822 sb->s_root = d_alloc_root(root); 822 sb->s_root = d_make_root(root);
823 if (!sb->s_root) { 823 if (!sb->s_root) {
824 iput(root);
825 EXOFS_ERR("ERROR: get root inode failed\n"); 824 EXOFS_ERR("ERROR: get root inode failed\n");
826 ret = -ENOMEM; 825 ret = -ENOMEM;
827 goto free_sbi; 826 goto free_sbi;
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 9f6766a3ac1e..e1025c7a437a 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -1088,9 +1088,8 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
1088 goto failed_mount3; 1088 goto failed_mount3;
1089 } 1089 }
1090 1090
1091 sb->s_root = d_alloc_root(root); 1091 sb->s_root = d_make_root(root);
1092 if (!sb->s_root) { 1092 if (!sb->s_root) {
1093 iput(root);
1094 ext2_msg(sb, KERN_ERR, "error: get root inode failed"); 1093 ext2_msg(sb, KERN_ERR, "error: get root inode failed");
1095 ret = -ENOMEM; 1094 ret = -ENOMEM;
1096 goto failed_mount3; 1095 goto failed_mount3;
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 726c7ef6cdf1..e0b45b93327b 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -2046,10 +2046,9 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
2046 ext3_msg(sb, KERN_ERR, "error: corrupt root inode, run e2fsck"); 2046 ext3_msg(sb, KERN_ERR, "error: corrupt root inode, run e2fsck");
2047 goto failed_mount3; 2047 goto failed_mount3;
2048 } 2048 }
2049 sb->s_root = d_alloc_root(root); 2049 sb->s_root = d_make_root(root);
2050 if (!sb->s_root) { 2050 if (!sb->s_root) {
2051 ext3_msg(sb, KERN_ERR, "error: get root dentry failed"); 2051 ext3_msg(sb, KERN_ERR, "error: get root dentry failed");
2052 iput(root);
2053 ret = -ENOMEM; 2052 ret = -ENOMEM;
2054 goto failed_mount3; 2053 goto failed_mount3;
2055 } 2054 }
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 502c61fd7392..d2baea7bcf30 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3735,9 +3735,8 @@ no_journal:
3735 iput(root); 3735 iput(root);
3736 goto failed_mount4; 3736 goto failed_mount4;
3737 } 3737 }
3738 sb->s_root = d_alloc_root(root); 3738 sb->s_root = d_make_root(root);
3739 if (!sb->s_root) { 3739 if (!sb->s_root) {
3740 iput(root);
3741 ext4_msg(sb, KERN_ERR, "get root dentry failed"); 3740 ext4_msg(sb, KERN_ERR, "get root dentry failed");
3742 ret = -ENOMEM; 3741 ret = -ENOMEM;
3743 goto failed_mount4; 3742 goto failed_mount4;
diff --git a/fs/freevxfs/vxfs_super.c b/fs/freevxfs/vxfs_super.c
index 9d1c99558389..d4fabd26084e 100644
--- a/fs/freevxfs/vxfs_super.c
+++ b/fs/freevxfs/vxfs_super.c
@@ -224,9 +224,8 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent)
224 ret = PTR_ERR(root); 224 ret = PTR_ERR(root);
225 goto out; 225 goto out;
226 } 226 }
227 sbp->s_root = d_alloc_root(root); 227 sbp->s_root = d_make_root(root);
228 if (!sbp->s_root) { 228 if (!sbp->s_root) {
229 iput(root);
230 printk(KERN_WARNING "vxfs: unable to get root dentry.\n"); 229 printk(KERN_WARNING "vxfs: unable to get root dentry.\n");
231 goto out_free_ilist; 230 goto out_free_ilist;
232 } 231 }
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 64cf8d07393e..4aec5995867e 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -988,14 +988,9 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
988 988
989 err = -ENOMEM; 989 err = -ENOMEM;
990 root = fuse_get_root_inode(sb, d.rootmode); 990 root = fuse_get_root_inode(sb, d.rootmode);
991 if (!root) 991 root_dentry = d_make_root(root);
992 if (!root_dentry)
992 goto err_put_conn; 993 goto err_put_conn;
993
994 root_dentry = d_alloc_root(root);
995 if (!root_dentry) {
996 iput(root);
997 goto err_put_conn;
998 }
999 /* only now - we want root dentry with NULL ->d_op */ 994 /* only now - we want root dentry with NULL ->d_op */
1000 sb->s_d_op = &fuse_dentry_operations; 995 sb->s_d_op = &fuse_dentry_operations;
1001 996
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index 24f609c9ef91..10e848c6d1b5 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -431,10 +431,9 @@ static int gfs2_lookup_root(struct super_block *sb, struct dentry **dptr,
431 fs_err(sdp, "can't read in %s inode: %ld\n", name, PTR_ERR(inode)); 431 fs_err(sdp, "can't read in %s inode: %ld\n", name, PTR_ERR(inode));
432 return PTR_ERR(inode); 432 return PTR_ERR(inode);
433 } 433 }
434 dentry = d_alloc_root(inode); 434 dentry = d_make_root(inode);
435 if (!dentry) { 435 if (!dentry) {
436 fs_err(sdp, "can't alloc %s dentry\n", name); 436 fs_err(sdp, "can't alloc %s dentry\n", name);
437 iput(inode);
438 return -ENOMEM; 437 return -ENOMEM;
439 } 438 }
440 *dptr = dentry; 439 *dptr = dentry;
diff --git a/fs/hfs/super.c b/fs/hfs/super.c
index 8137fb3e6780..7b4c537d6e13 100644
--- a/fs/hfs/super.c
+++ b/fs/hfs/super.c
@@ -430,15 +430,13 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent)
430 430
431 sb->s_d_op = &hfs_dentry_operations; 431 sb->s_d_op = &hfs_dentry_operations;
432 res = -ENOMEM; 432 res = -ENOMEM;
433 sb->s_root = d_alloc_root(root_inode); 433 sb->s_root = d_make_root(root_inode);
434 if (!sb->s_root) 434 if (!sb->s_root)
435 goto bail_iput; 435 goto bail_no_root;
436 436
437 /* everything's okay */ 437 /* everything's okay */
438 return 0; 438 return 0;
439 439
440bail_iput:
441 iput(root_inode);
442bail_no_root: 440bail_no_root:
443 printk(KERN_ERR "hfs: get root inode failed.\n"); 441 printk(KERN_ERR "hfs: get root inode failed.\n");
444bail: 442bail:
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index e130bd46d671..588d45885a6f 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -966,9 +966,9 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
966 } 966 }
967 967
968 err = -ENOMEM; 968 err = -ENOMEM;
969 sb->s_root = d_alloc_root(root_inode); 969 sb->s_root = d_make_root(root_inode);
970 if (sb->s_root == NULL) 970 if (sb->s_root == NULL)
971 goto out_put; 971 goto out;
972 972
973 return 0; 973 return 0;
974 974
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c
index 3690467c944e..54f6eccb79d9 100644
--- a/fs/hpfs/super.c
+++ b/fs/hpfs/super.c
@@ -625,11 +625,9 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
625 hpfs_init_inode(root); 625 hpfs_init_inode(root);
626 hpfs_read_inode(root); 626 hpfs_read_inode(root);
627 unlock_new_inode(root); 627 unlock_new_inode(root);
628 s->s_root = d_alloc_root(root); 628 s->s_root = d_make_root(root);
629 if (!s->s_root) { 629 if (!s->s_root)
630 iput(root);
631 goto bail0; 630 goto bail0;
632 }
633 631
634 /* 632 /*
635 * find the root directory's . pointer & finish filling in the inode 633 * find the root directory's . pointer & finish filling in the inode
diff --git a/fs/hppfs/hppfs.c b/fs/hppfs/hppfs.c
index d92f4ce80925..a80e45a690ac 100644
--- a/fs/hppfs/hppfs.c
+++ b/fs/hppfs/hppfs.c
@@ -726,17 +726,12 @@ static int hppfs_fill_super(struct super_block *sb, void *d, int silent)
726 726
727 err = -ENOMEM; 727 err = -ENOMEM;
728 root_inode = get_inode(sb, dget(proc_mnt->mnt_root)); 728 root_inode = get_inode(sb, dget(proc_mnt->mnt_root));
729 if (!root_inode) 729 sb->s_root = d_make_root(root_inode);
730 goto out_mntput;
731
732 sb->s_root = d_alloc_root(root_inode);
733 if (!sb->s_root) 730 if (!sb->s_root)
734 goto out_iput; 731 goto out_mntput;
735 732
736 return 0; 733 return 0;
737 734
738 out_iput:
739 iput(root_inode);
740 out_mntput: 735 out_mntput:
741 mntput(proc_mnt); 736 mntput(proc_mnt);
742 out: 737 out:
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 1e85a7ac0217..81932fa1861a 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -831,8 +831,6 @@ bad_val:
831static int 831static int
832hugetlbfs_fill_super(struct super_block *sb, void *data, int silent) 832hugetlbfs_fill_super(struct super_block *sb, void *data, int silent)
833{ 833{
834 struct inode * inode;
835 struct dentry * root;
836 int ret; 834 int ret;
837 struct hugetlbfs_config config; 835 struct hugetlbfs_config config;
838 struct hugetlbfs_sb_info *sbinfo; 836 struct hugetlbfs_sb_info *sbinfo;
@@ -865,16 +863,9 @@ hugetlbfs_fill_super(struct super_block *sb, void *data, int silent)
865 sb->s_magic = HUGETLBFS_MAGIC; 863 sb->s_magic = HUGETLBFS_MAGIC;
866 sb->s_op = &hugetlbfs_ops; 864 sb->s_op = &hugetlbfs_ops;
867 sb->s_time_gran = 1; 865 sb->s_time_gran = 1;
868 inode = hugetlbfs_get_root(sb, &config); 866 sb->s_root = d_make_root(hugetlbfs_get_root(sb, &config));
869 if (!inode) 867 if (!sb->s_root)
870 goto out_free;
871
872 root = d_alloc_root(inode);
873 if (!root) {
874 iput(inode);
875 goto out_free; 868 goto out_free;
876 }
877 sb->s_root = root;
878 return 0; 869 return 0;
879out_free: 870out_free:
880 kfree(sbinfo); 871 kfree(sbinfo);
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index bd62c76fb5df..29037c365ba4 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -947,9 +947,8 @@ root_found:
947 s->s_d_op = &isofs_dentry_ops[table]; 947 s->s_d_op = &isofs_dentry_ops[table];
948 948
949 /* get the root dentry */ 949 /* get the root dentry */
950 s->s_root = d_alloc_root(inode); 950 s->s_root = d_make_root(inode);
951 if (!(s->s_root)) { 951 if (!(s->s_root)) {
952 iput(inode);
953 error = -ENOMEM; 952 error = -ENOMEM;
954 goto out_no_inode; 953 goto out_no_inode;
955 } 954 }
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c
index 2e0123867cb1..c0d5c9d770da 100644
--- a/fs/jffs2/fs.c
+++ b/fs/jffs2/fs.c
@@ -561,9 +561,9 @@ int jffs2_do_fill_super(struct super_block *sb, void *data, int silent)
561 ret = -ENOMEM; 561 ret = -ENOMEM;
562 562
563 D1(printk(KERN_DEBUG "jffs2_do_fill_super(): d_alloc_root()\n")); 563 D1(printk(KERN_DEBUG "jffs2_do_fill_super(): d_alloc_root()\n"));
564 sb->s_root = d_alloc_root(root_i); 564 sb->s_root = d_make_root(root_i);
565 if (!sb->s_root) 565 if (!sb->s_root)
566 goto out_root_i; 566 goto out_root;
567 567
568 sb->s_maxbytes = 0xFFFFFFFF; 568 sb->s_maxbytes = 0xFFFFFFFF;
569 sb->s_blocksize = PAGE_CACHE_SIZE; 569 sb->s_blocksize = PAGE_CACHE_SIZE;
@@ -573,8 +573,6 @@ int jffs2_do_fill_super(struct super_block *sb, void *data, int silent)
573 jffs2_start_garbage_collect_thread(c); 573 jffs2_start_garbage_collect_thread(c);
574 return 0; 574 return 0;
575 575
576 out_root_i:
577 iput(root_i);
578out_root: 576out_root:
579 jffs2_free_ino_caches(c); 577 jffs2_free_ino_caches(c);
580 jffs2_free_raw_node_refs(c); 578 jffs2_free_raw_node_refs(c);
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index 4661ad705130..b3bb95504479 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -522,7 +522,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
522 ret = PTR_ERR(inode); 522 ret = PTR_ERR(inode);
523 goto out_no_rw; 523 goto out_no_rw;
524 } 524 }
525 sb->s_root = d_alloc_root(inode); 525 sb->s_root = d_make_root(inode);
526 if (!sb->s_root) 526 if (!sb->s_root)
527 goto out_no_root; 527 goto out_no_root;
528 528
@@ -540,7 +540,6 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
540 540
541out_no_root: 541out_no_root:
542 jfs_err("jfs_read_super: get root dentry failed"); 542 jfs_err("jfs_read_super: get root dentry failed");
543 iput(inode);
544 543
545out_no_rw: 544out_no_rw:
546 rc = jfs_umount(sb); 545 rc = jfs_umount(sb);
diff --git a/fs/libfs.c b/fs/libfs.c
index 5b2dbb3ba4fc..7c895a763a1e 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -491,11 +491,9 @@ int simple_fill_super(struct super_block *s, unsigned long magic,
491 inode->i_op = &simple_dir_inode_operations; 491 inode->i_op = &simple_dir_inode_operations;
492 inode->i_fop = &simple_dir_operations; 492 inode->i_fop = &simple_dir_operations;
493 set_nlink(inode, 2); 493 set_nlink(inode, 2);
494 root = d_alloc_root(inode); 494 root = d_make_root(inode);
495 if (!root) { 495 if (!root)
496 iput(inode);
497 return -ENOMEM; 496 return -ENOMEM;
498 }
499 for (i = 0; !files->name || files->name[0]; i++, files++) { 497 for (i = 0; !files->name || files->name[0]; i++, files++) {
500 if (!files->name) 498 if (!files->name)
501 continue; 499 continue;
diff --git a/fs/logfs/super.c b/fs/logfs/super.c
index b1a491a5fe78..7de18c3021fe 100644
--- a/fs/logfs/super.c
+++ b/fs/logfs/super.c
@@ -315,11 +315,9 @@ static int logfs_get_sb_final(struct super_block *sb)
315 if (IS_ERR(rootdir)) 315 if (IS_ERR(rootdir))
316 goto fail; 316 goto fail;
317 317
318 sb->s_root = d_alloc_root(rootdir); 318 sb->s_root = d_make_root(rootdir);
319 if (!sb->s_root) { 319 if (!sb->s_root)
320 iput(rootdir);
321 goto fail; 320 goto fail;
322 }
323 321
324 /* at that point we know that ->put_super() will be called */ 322 /* at that point we know that ->put_super() will be called */
325 super->s_erase_page = alloc_pages(GFP_KERNEL, 0); 323 super->s_erase_page = alloc_pages(GFP_KERNEL, 0);
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c
index 3d1e34f8a68e..49df0e7f8379 100644
--- a/fs/ncpfs/inode.c
+++ b/fs/ncpfs/inode.c
@@ -716,13 +716,11 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
716 if (!root_inode) 716 if (!root_inode)
717 goto out_disconnect; 717 goto out_disconnect;
718 DPRINTK("ncp_fill_super: root vol=%d\n", NCP_FINFO(root_inode)->volNumber); 718 DPRINTK("ncp_fill_super: root vol=%d\n", NCP_FINFO(root_inode)->volNumber);
719 sb->s_root = d_alloc_root(root_inode); 719 sb->s_root = d_make_root(root_inode);
720 if (!sb->s_root) 720 if (!sb->s_root)
721 goto out_no_root; 721 goto out_disconnect;
722 return 0; 722 return 0;
723 723
724out_no_root:
725 iput(root_inode);
726out_disconnect: 724out_disconnect:
727 ncp_lock_server(server); 725 ncp_lock_server(server);
728 ncp_disconnect(server); 726 ncp_disconnect(server);
diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c
index dcb61548887f..801d6d830787 100644
--- a/fs/nfs/getroot.c
+++ b/fs/nfs/getroot.c
@@ -49,11 +49,9 @@ static int nfs_superblock_set_dummy_root(struct super_block *sb, struct inode *i
49{ 49{
50 /* The mntroot acts as the dummy root dentry for this superblock */ 50 /* The mntroot acts as the dummy root dentry for this superblock */
51 if (sb->s_root == NULL) { 51 if (sb->s_root == NULL) {
52 sb->s_root = d_alloc_root(inode); 52 sb->s_root = d_make_root(inode);
53 if (sb->s_root == NULL) { 53 if (sb->s_root == NULL)
54 iput(inode);
55 return -ENOMEM; 54 return -ENOMEM;
56 }
57 ihold(inode); 55 ihold(inode);
58 /* 56 /*
59 * Ensure that this dentry is invisible to d_find_alias(). 57 * Ensure that this dentry is invisible to d_find_alias().
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c
index 1fc9ad3c1d14..1099a76cee59 100644
--- a/fs/nilfs2/super.c
+++ b/fs/nilfs2/super.c
@@ -917,9 +917,8 @@ static int nilfs_get_root_dentry(struct super_block *sb,
917 if (root->cno == NILFS_CPTREE_CURRENT_CNO) { 917 if (root->cno == NILFS_CPTREE_CURRENT_CNO) {
918 dentry = d_find_alias(inode); 918 dentry = d_find_alias(inode);
919 if (!dentry) { 919 if (!dentry) {
920 dentry = d_alloc_root(inode); 920 dentry = d_make_root(inode);
921 if (!dentry) { 921 if (!dentry) {
922 iput(inode);
923 ret = -ENOMEM; 922 ret = -ENOMEM;
924 goto failed_dentry; 923 goto failed_dentry;
925 } 924 }
diff --git a/fs/ocfs2/dlmfs/dlmfs.c b/fs/ocfs2/dlmfs/dlmfs.c
index abfac0d7ae9c..3b5825ef3193 100644
--- a/fs/ocfs2/dlmfs/dlmfs.c
+++ b/fs/ocfs2/dlmfs/dlmfs.c
@@ -582,24 +582,14 @@ static int dlmfs_fill_super(struct super_block * sb,
582 void * data, 582 void * data,
583 int silent) 583 int silent)
584{ 584{
585 struct inode * inode;
586 struct dentry * root;
587
588 sb->s_maxbytes = MAX_LFS_FILESIZE; 585 sb->s_maxbytes = MAX_LFS_FILESIZE;
589 sb->s_blocksize = PAGE_CACHE_SIZE; 586 sb->s_blocksize = PAGE_CACHE_SIZE;
590 sb->s_blocksize_bits = PAGE_CACHE_SHIFT; 587 sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
591 sb->s_magic = DLMFS_MAGIC; 588 sb->s_magic = DLMFS_MAGIC;
592 sb->s_op = &dlmfs_ops; 589 sb->s_op = &dlmfs_ops;
593 inode = dlmfs_get_root_inode(sb); 590 sb->s_root = d_make_root(dlmfs_get_root_inode(sb));
594 if (!inode) 591 if (!sb->s_root)
595 return -ENOMEM;
596
597 root = d_alloc_root(inode);
598 if (!root) {
599 iput(inode);
600 return -ENOMEM; 592 return -ENOMEM;
601 }
602 sb->s_root = root;
603 return 0; 593 return 0;
604} 594}
605 595
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index 2b1184f7097f..337687c3e233 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -1166,9 +1166,8 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
1166 goto read_super_error; 1166 goto read_super_error;
1167 } 1167 }
1168 1168
1169 root = d_alloc_root(inode); 1169 root = d_make_root(inode);
1170 if (!root) { 1170 if (!root) {
1171 iput(inode);
1172 status = -ENOMEM; 1171 status = -ENOMEM;
1173 mlog_errno(status); 1172 mlog_errno(status);
1174 goto read_super_error; 1173 goto read_super_error;
diff --git a/fs/omfs/inode.c b/fs/omfs/inode.c
index 6065bb0ba207..dbc842222589 100644
--- a/fs/omfs/inode.c
+++ b/fs/omfs/inode.c
@@ -539,11 +539,9 @@ static int omfs_fill_super(struct super_block *sb, void *data, int silent)
539 goto out_brelse_bh2; 539 goto out_brelse_bh2;
540 } 540 }
541 541
542 sb->s_root = d_alloc_root(root); 542 sb->s_root = d_make_root(root);
543 if (!sb->s_root) { 543 if (!sb->s_root)
544 iput(root);
545 goto out_brelse_bh2; 544 goto out_brelse_bh2;
546 }
547 printk(KERN_DEBUG "omfs: Mounted volume %s\n", omfs_rb->r_name); 545 printk(KERN_DEBUG "omfs: Mounted volume %s\n", omfs_rb->r_name);
548 546
549 ret = 0; 547 ret = 0;
diff --git a/fs/openpromfs/inode.c b/fs/openpromfs/inode.c
index a88c03bc749d..bc49c975d501 100644
--- a/fs/openpromfs/inode.c
+++ b/fs/openpromfs/inode.c
@@ -408,13 +408,12 @@ static int openprom_fill_super(struct super_block *s, void *data, int silent)
408 oi->type = op_inode_node; 408 oi->type = op_inode_node;
409 oi->u.node = of_find_node_by_path("/"); 409 oi->u.node = of_find_node_by_path("/");
410 410
411 s->s_root = d_alloc_root(root_inode); 411 s->s_root = d_make_root(root_inode);
412 if (!s->s_root) 412 if (!s->s_root)
413 goto out_no_root_dentry; 413 goto out_no_root_dentry;
414 return 0; 414 return 0;
415 415
416out_no_root_dentry: 416out_no_root_dentry:
417 iput(root_inode);
418 ret = -ENOMEM; 417 ret = -ENOMEM;
419out_no_root: 418out_no_root:
420 printk("openprom_fill_super: get root inode failed\n"); 419 printk("openprom_fill_super: get root inode failed\n");
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index a70af3a44f45..8461a7b82fdb 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -486,8 +486,6 @@ struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de)
486 486
487int proc_fill_super(struct super_block *s) 487int proc_fill_super(struct super_block *s)
488{ 488{
489 struct inode * root_inode;
490
491 s->s_flags |= MS_NODIRATIME | MS_NOSUID | MS_NOEXEC; 489 s->s_flags |= MS_NODIRATIME | MS_NOSUID | MS_NOEXEC;
492 s->s_blocksize = 1024; 490 s->s_blocksize = 1024;
493 s->s_blocksize_bits = 10; 491 s->s_blocksize_bits = 10;
@@ -496,17 +494,10 @@ int proc_fill_super(struct super_block *s)
496 s->s_time_gran = 1; 494 s->s_time_gran = 1;
497 495
498 pde_get(&proc_root); 496 pde_get(&proc_root);
499 root_inode = proc_get_inode(s, &proc_root); 497 s->s_root = d_make_root(proc_get_inode(s, &proc_root));
500 if (!root_inode) 498 if (s->s_root)
501 goto out_no_root; 499 return 0;
502 s->s_root = d_alloc_root(root_inode);
503 if (!s->s_root) {
504 iput(root_inode);
505 goto out_no_root;
506 }
507 return 0;
508 500
509out_no_root:
510 printk("proc_read_super: get root inode failed\n"); 501 printk("proc_read_super: get root inode failed\n");
511 pde_put(&proc_root); 502 pde_put(&proc_root);
512 return -ENOMEM; 503 return -ENOMEM;
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
index b3b426edb2fd..ec7d1fb6f35a 100644
--- a/fs/pstore/inode.c
+++ b/fs/pstore/inode.c
@@ -303,7 +303,7 @@ int pstore_fill_super(struct super_block *sb, void *data, int silent)
303 /* override ramfs "dir" options so we catch unlink(2) */ 303 /* override ramfs "dir" options so we catch unlink(2) */
304 inode->i_op = &pstore_dir_inode_operations; 304 inode->i_op = &pstore_dir_inode_operations;
305 305
306 root = d_alloc_root(inode); 306 root = d_make_root(inode);
307 sb->s_root = root; 307 sb->s_root = root;
308 if (!root) { 308 if (!root) {
309 err = -ENOMEM; 309 err = -ENOMEM;
@@ -314,7 +314,6 @@ int pstore_fill_super(struct super_block *sb, void *data, int silent)
314 314
315 return 0; 315 return 0;
316fail: 316fail:
317 iput(inode);
318 return err; 317 return err;
319} 318}
320 319
diff --git a/fs/qnx4/inode.c b/fs/qnx4/inode.c
index 6b009548d2e0..db18d866d981 100644
--- a/fs/qnx4/inode.c
+++ b/fs/qnx4/inode.c
@@ -260,15 +260,13 @@ static int qnx4_fill_super(struct super_block *s, void *data, int silent)
260 } 260 }
261 261
262 ret = -ENOMEM; 262 ret = -ENOMEM;
263 s->s_root = d_alloc_root(root); 263 s->s_root = d_make_root(root);
264 if (s->s_root == NULL) 264 if (s->s_root == NULL)
265 goto outi; 265 goto outb;
266 266
267 brelse(bh); 267 brelse(bh);
268 return 0; 268 return 0;
269 269
270 outi:
271 iput(root);
272 outb: 270 outb:
273 kfree(qs->BitMap); 271 kfree(qs->BitMap);
274 out: 272 out:
diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c
index aec766abe3af..b6612d2ed718 100644
--- a/fs/ramfs/inode.c
+++ b/fs/ramfs/inode.c
@@ -210,7 +210,6 @@ int ramfs_fill_super(struct super_block *sb, void *data, int silent)
210{ 210{
211 struct ramfs_fs_info *fsi; 211 struct ramfs_fs_info *fsi;
212 struct inode *inode = NULL; 212 struct inode *inode = NULL;
213 struct dentry *root;
214 int err; 213 int err;
215 214
216 save_mount_options(sb, data); 215 save_mount_options(sb, data);
@@ -234,14 +233,8 @@ int ramfs_fill_super(struct super_block *sb, void *data, int silent)
234 sb->s_time_gran = 1; 233 sb->s_time_gran = 1;
235 234
236 inode = ramfs_get_inode(sb, NULL, S_IFDIR | fsi->mount_opts.mode, 0); 235 inode = ramfs_get_inode(sb, NULL, S_IFDIR | fsi->mount_opts.mode, 0);
237 if (!inode) { 236 sb->s_root = d_make_root(inode);
238 err = -ENOMEM; 237 if (!sb->s_root) {
239 goto fail;
240 }
241
242 root = d_alloc_root(inode);
243 sb->s_root = root;
244 if (!root) {
245 err = -ENOMEM; 238 err = -ENOMEM;
246 goto fail; 239 goto fail;
247 } 240 }
@@ -250,7 +243,6 @@ int ramfs_fill_super(struct super_block *sb, void *data, int silent)
250fail: 243fail:
251 kfree(fsi); 244 kfree(fsi);
252 sb->s_fs_info = NULL; 245 sb->s_fs_info = NULL;
253 iput(inode);
254 return err; 246 return err;
255} 247}
256 248
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index e12d8b97cd4d..208dfd144409 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -1874,11 +1874,9 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1874 unlock_new_inode(root_inode); 1874 unlock_new_inode(root_inode);
1875 } 1875 }
1876 1876
1877 s->s_root = d_alloc_root(root_inode); 1877 s->s_root = d_make_root(root_inode);
1878 if (!s->s_root) { 1878 if (!s->s_root)
1879 iput(root_inode);
1880 goto error; 1879 goto error;
1881 }
1882 // define and initialize hash function 1880 // define and initialize hash function
1883 sbi->s_hash_function = hash_function(s); 1881 sbi->s_hash_function = hash_function(s);
1884 if (sbi->s_hash_function == NULL) { 1882 if (sbi->s_hash_function == NULL) {
diff --git a/fs/romfs/super.c b/fs/romfs/super.c
index bb36ab74eb45..e64f6b5f7ae5 100644
--- a/fs/romfs/super.c
+++ b/fs/romfs/super.c
@@ -538,14 +538,12 @@ static int romfs_fill_super(struct super_block *sb, void *data, int silent)
538 if (IS_ERR(root)) 538 if (IS_ERR(root))
539 goto error; 539 goto error;
540 540
541 sb->s_root = d_alloc_root(root); 541 sb->s_root = d_make_root(root);
542 if (!sb->s_root) 542 if (!sb->s_root)
543 goto error_i; 543 goto error;
544 544
545 return 0; 545 return 0;
546 546
547error_i:
548 iput(root);
549error: 547error:
550 return -EINVAL; 548 return -EINVAL;
551error_rsb_inval: 549error_rsb_inval:
diff --git a/fs/squashfs/super.c b/fs/squashfs/super.c
index ecaa2f7bdb8f..970b1167e7cb 100644
--- a/fs/squashfs/super.c
+++ b/fs/squashfs/super.c
@@ -316,11 +316,10 @@ check_directory_table:
316 } 316 }
317 insert_inode_hash(root); 317 insert_inode_hash(root);
318 318
319 sb->s_root = d_alloc_root(root); 319 sb->s_root = d_make_root(root);
320 if (sb->s_root == NULL) { 320 if (sb->s_root == NULL) {
321 ERROR("Root inode create failed\n"); 321 ERROR("Root inode create failed\n");
322 err = -ENOMEM; 322 err = -ENOMEM;
323 iput(root);
324 goto failed_mount; 323 goto failed_mount;
325 } 324 }
326 325
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c
index e34f0d99ea4e..2243f8ec64d5 100644
--- a/fs/sysfs/mount.c
+++ b/fs/sysfs/mount.c
@@ -61,10 +61,9 @@ static int sysfs_fill_super(struct super_block *sb, void *data, int silent)
61 } 61 }
62 62
63 /* instantiate and link root dentry */ 63 /* instantiate and link root dentry */
64 root = d_alloc_root(inode); 64 root = d_make_root(inode);
65 if (!root) { 65 if (!root) {
66 pr_debug("%s: could not get root dentry!\n",__func__); 66 pr_debug("%s: could not get root dentry!\n",__func__);
67 iput(inode);
68 return -ENOMEM; 67 return -ENOMEM;
69 } 68 }
70 root->d_fsdata = &sysfs_root; 69 root->d_fsdata = &sysfs_root;
diff --git a/fs/sysv/super.c b/fs/sysv/super.c
index f467740e088c..7491c33b6468 100644
--- a/fs/sysv/super.c
+++ b/fs/sysv/super.c
@@ -341,9 +341,8 @@ static int complete_read_super(struct super_block *sb, int silent, int size)
341 printk("SysV FS: get root inode failed\n"); 341 printk("SysV FS: get root inode failed\n");
342 return 0; 342 return 0;
343 } 343 }
344 sb->s_root = d_alloc_root(root_inode); 344 sb->s_root = d_make_root(root_inode);
345 if (!sb->s_root) { 345 if (!sb->s_root) {
346 iput(root_inode);
347 printk("SysV FS: get root dentry failed\n"); 346 printk("SysV FS: get root dentry failed\n");
348 return 0; 347 return 0;
349 } 348 }
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 63765d58445b..76e4e0566ad6 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -2076,15 +2076,13 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent)
2076 goto out_umount; 2076 goto out_umount;
2077 } 2077 }
2078 2078
2079 sb->s_root = d_alloc_root(root); 2079 sb->s_root = d_make_root(root);
2080 if (!sb->s_root) 2080 if (!sb->s_root)
2081 goto out_iput; 2081 goto out_umount;
2082 2082
2083 mutex_unlock(&c->umount_mutex); 2083 mutex_unlock(&c->umount_mutex);
2084 return 0; 2084 return 0;
2085 2085
2086out_iput:
2087 iput(root);
2088out_umount: 2086out_umount:
2089 ubifs_umount(c); 2087 ubifs_umount(c);
2090out_unlock: 2088out_unlock:
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 8d8b25336fbb..85067b4c7e14 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -2037,10 +2037,9 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
2037 } 2037 }
2038 2038
2039 /* Allocate a dentry for the root inode */ 2039 /* Allocate a dentry for the root inode */
2040 sb->s_root = d_alloc_root(inode); 2040 sb->s_root = d_make_root(inode);
2041 if (!sb->s_root) { 2041 if (!sb->s_root) {
2042 udf_err(sb, "Couldn't allocate root dentry\n"); 2042 udf_err(sb, "Couldn't allocate root dentry\n");
2043 iput(inode);
2044 goto error_out; 2043 goto error_out;
2045 } 2044 }
2046 sb->s_maxbytes = MAX_LFS_FILESIZE; 2045 sb->s_maxbytes = MAX_LFS_FILESIZE;
diff --git a/fs/ufs/super.c b/fs/ufs/super.c
index ec25d09fcaa8..f636f6b460d0 100644
--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -1164,10 +1164,10 @@ magic_found:
1164 ret = PTR_ERR(inode); 1164 ret = PTR_ERR(inode);
1165 goto failed; 1165 goto failed;
1166 } 1166 }
1167 sb->s_root = d_alloc_root(inode); 1167 sb->s_root = d_make_root(inode);
1168 if (!sb->s_root) { 1168 if (!sb->s_root) {
1169 ret = -ENOMEM; 1169 ret = -ENOMEM;
1170 goto dalloc_failed; 1170 goto failed;
1171 } 1171 }
1172 1172
1173 ufs_setup_cstotal(sb); 1173 ufs_setup_cstotal(sb);
@@ -1181,8 +1181,6 @@ magic_found:
1181 UFSD("EXIT\n"); 1181 UFSD("EXIT\n");
1182 return 0; 1182 return 0;
1183 1183
1184dalloc_failed:
1185 iput(inode);
1186failed: 1184failed:
1187 if (ubh) 1185 if (ubh)
1188 ubh_brelse_uspi (uspi); 1186 ubh_brelse_uspi (uspi);
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 0e4c5c017fba..baf40e378d35 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -1362,10 +1362,10 @@ xfs_fs_fill_super(
1362 error = EINVAL; 1362 error = EINVAL;
1363 goto out_syncd_stop; 1363 goto out_syncd_stop;
1364 } 1364 }
1365 sb->s_root = d_alloc_root(root); 1365 sb->s_root = d_make_root(root);
1366 if (!sb->s_root) { 1366 if (!sb->s_root) {
1367 error = ENOMEM; 1367 error = ENOMEM;
1368 goto out_iput; 1368 goto out_syncd_stop;
1369 } 1369 }
1370 1370
1371 return 0; 1371 return 0;
@@ -1384,8 +1384,6 @@ xfs_fs_fill_super(
1384 out: 1384 out:
1385 return -error; 1385 return -error;
1386 1386
1387 out_iput:
1388 iput(root);
1389 out_syncd_stop: 1387 out_syncd_stop:
1390 xfs_syncd_stop(mp); 1388 xfs_syncd_stop(mp);
1391 out_unmount: 1389 out_unmount:
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 86ee272de210..28bd64ddeda3 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -188,30 +188,20 @@ static int mqueue_fill_super(struct super_block *sb, void *data, int silent)
188{ 188{
189 struct inode *inode; 189 struct inode *inode;
190 struct ipc_namespace *ns = data; 190 struct ipc_namespace *ns = data;
191 int error;
192 191
193 sb->s_blocksize = PAGE_CACHE_SIZE; 192 sb->s_blocksize = PAGE_CACHE_SIZE;
194 sb->s_blocksize_bits = PAGE_CACHE_SHIFT; 193 sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
195 sb->s_magic = MQUEUE_MAGIC; 194 sb->s_magic = MQUEUE_MAGIC;
196 sb->s_op = &mqueue_super_ops; 195 sb->s_op = &mqueue_super_ops;
197 196
198 inode = mqueue_get_inode(sb, ns, S_IFDIR | S_ISVTX | S_IRWXUGO, 197 inode = mqueue_get_inode(sb, ns, S_IFDIR | S_ISVTX | S_IRWXUGO, NULL);
199 NULL); 198 if (IS_ERR(inode))
200 if (IS_ERR(inode)) { 199 return PTR_ERR(inode);
201 error = PTR_ERR(inode);
202 goto out;
203 }
204 200
205 sb->s_root = d_alloc_root(inode); 201 sb->s_root = d_make_root(inode);
206 if (!sb->s_root) { 202 if (!sb->s_root)
207 iput(inode); 203 return -ENOMEM;
208 error = -ENOMEM; 204 return 0;
209 goto out;
210 }
211 error = 0;
212
213out:
214 return error;
215} 205}
216 206
217static struct dentry *mqueue_mount(struct file_system_type *fs_type, 207static struct dentry *mqueue_mount(struct file_system_type *fs_type,
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index a5d3b5325f77..711c1a30ceaa 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1472,7 +1472,6 @@ static int cgroup_get_rootdir(struct super_block *sb)
1472 1472
1473 struct inode *inode = 1473 struct inode *inode =
1474 cgroup_new_inode(S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR, sb); 1474 cgroup_new_inode(S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR, sb);
1475 struct dentry *dentry;
1476 1475
1477 if (!inode) 1476 if (!inode)
1478 return -ENOMEM; 1477 return -ENOMEM;
@@ -1481,12 +1480,9 @@ static int cgroup_get_rootdir(struct super_block *sb)
1481 inode->i_op = &cgroup_dir_inode_operations; 1480 inode->i_op = &cgroup_dir_inode_operations;
1482 /* directories start off with i_nlink == 2 (for "." entry) */ 1481 /* directories start off with i_nlink == 2 (for "." entry) */
1483 inc_nlink(inode); 1482 inc_nlink(inode);
1484 dentry = d_alloc_root(inode); 1483 sb->s_root = d_make_root(inode);
1485 if (!dentry) { 1484 if (!sb->s_root)
1486 iput(inode);
1487 return -ENOMEM; 1485 return -ENOMEM;
1488 }
1489 sb->s_root = dentry;
1490 /* for everything else we want ->d_op set */ 1486 /* for everything else we want ->d_op set */
1491 sb->s_d_op = &cgroup_dops; 1487 sb->s_d_op = &cgroup_dops;
1492 return 0; 1488 return 0;
diff --git a/mm/shmem.c b/mm/shmem.c
index 269d049294ab..154243f0a27c 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2232,14 +2232,12 @@ int shmem_fill_super(struct super_block *sb, void *data, int silent)
2232 goto failed; 2232 goto failed;
2233 inode->i_uid = sbinfo->uid; 2233 inode->i_uid = sbinfo->uid;
2234 inode->i_gid = sbinfo->gid; 2234 inode->i_gid = sbinfo->gid;
2235 root = d_alloc_root(inode); 2235 root = d_make_root(inode);
2236 if (!root) 2236 if (!root)
2237 goto failed_iput; 2237 goto failed;
2238 sb->s_root = root; 2238 sb->s_root = root;
2239 return 0; 2239 return 0;
2240 2240
2241failed_iput:
2242 iput(inode);
2243failed: 2241failed:
2244 shmem_put_super(sb); 2242 shmem_put_super(sb);
2245 return err; 2243 return err;
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 63a7a7add21e..7d6dd6efbdbe 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -1033,13 +1033,9 @@ rpc_fill_super(struct super_block *sb, void *data, int silent)
1033 sb->s_time_gran = 1; 1033 sb->s_time_gran = 1;
1034 1034
1035 inode = rpc_get_inode(sb, S_IFDIR | 0755); 1035 inode = rpc_get_inode(sb, S_IFDIR | 0755);
1036 if (!inode) 1036 sb->s_root = root = d_make_root(inode);
1037 return -ENOMEM; 1037 if (!root)
1038 sb->s_root = root = d_alloc_root(inode);
1039 if (!root) {
1040 iput(inode);
1041 return -ENOMEM; 1038 return -ENOMEM;
1042 }
1043 if (rpc_populate(root, files, RPCAUTH_lockd, RPCAUTH_RootEOF, NULL)) 1039 if (rpc_populate(root, files, RPCAUTH_lockd, RPCAUTH_RootEOF, NULL))
1044 return -ENOMEM; 1040 return -ENOMEM;
1045 return 0; 1041 return 0;