switch open-coded instances of d_make_root() to new helper

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro 2012-01-08 22:15:13 -05:00
Родитель 6b4231e2f9
Коммит 48fde701af
64 изменённых файлов: 105 добавлений и 264 удалений

Просмотреть файл

@ -757,9 +757,9 @@ spufs_create_root(struct super_block *sb, void *data)
goto out_iput; goto out_iput;
ret = -ENOMEM; ret = -ENOMEM;
sb->s_root = d_alloc_root(inode); sb->s_root = d_make_root(inode);
if (!sb->s_root) if (!sb->s_root)
goto out_iput; goto out;
return 0; return 0;
out_iput: out_iput:

Просмотреть файл

@ -293,11 +293,9 @@ static int hypfs_fill_super(struct super_block *sb, void *data, int silent)
return -ENOMEM; return -ENOMEM;
root_inode->i_op = &simple_dir_inode_operations; root_inode->i_op = &simple_dir_inode_operations;
root_inode->i_fop = &simple_dir_operations; root_inode->i_fop = &simple_dir_operations;
sb->s_root = root_dentry = d_alloc_root(root_inode); sb->s_root = root_dentry = d_make_root(root_inode);
if (!root_dentry) { if (!root_dentry)
iput(root_inode);
return -ENOMEM; return -ENOMEM;
}
if (MACHINE_IS_VM) if (MACHINE_IS_VM)
rc = hypfs_vm_create_files(sb, root_dentry); rc = hypfs_vm_create_files(sb, root_dentry);
else else

Просмотреть файл

@ -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_op = &simple_dir_inode_operations;
root->i_fop = ibmasmfs_dir_ops; root->i_fop = ibmasmfs_dir_ops;
root_dentry = d_alloc_root(root); root_dentry = d_make_root(root);
if (!root_dentry) { if (!root_dentry)
iput(root);
return -ENOMEM; return -ENOMEM;
}
sb->s_root = root_dentry; sb->s_root = root_dentry;
ibmasmfs_create_files(sb, root_dentry); ibmasmfs_create_files(sb, root_dentry);

Просмотреть файл

@ -251,11 +251,9 @@ static int oprofilefs_fill_super(struct super_block *sb, void *data, int silent)
return -ENOMEM; return -ENOMEM;
root_inode->i_op = &simple_dir_inode_operations; root_inode->i_op = &simple_dir_inode_operations;
root_inode->i_fop = &simple_dir_operations; root_inode->i_fop = &simple_dir_operations;
root_dentry = d_alloc_root(root_inode); root_dentry = d_make_root(root_inode);
if (!root_dentry) { if (!root_dentry)
iput(root_inode);
return -ENOMEM; return -ENOMEM;
}
sb->s_root = root_dentry; sb->s_root = root_dentry;

Просмотреть файл

@ -462,16 +462,9 @@ static int usbfs_fill_super(struct super_block *sb, void *data, int silent)
sb->s_op = &usbfs_ops; sb->s_op = &usbfs_ops;
sb->s_time_gran = 1; sb->s_time_gran = 1;
inode = usbfs_get_inode(sb, S_IFDIR | 0755, 0); inode = usbfs_get_inode(sb, S_IFDIR | 0755, 0);
root = d_make_root(inode);
if (!inode) {
dbg("%s: could not get inode!",__func__);
return -ENOMEM;
}
root = d_alloc_root(inode);
if (!root) { if (!root) {
dbg("%s: could not get root dentry!",__func__); dbg("%s: could not get root dentry!",__func__);
iput(inode);
return -ENOMEM; return -ENOMEM;
} }
sb->s_root = root; sb->s_root = root;

Просмотреть файл

@ -1063,13 +1063,9 @@ static int ffs_sb_fill(struct super_block *sb, void *_data, int silent)
&simple_dir_operations, &simple_dir_operations,
&simple_dir_inode_operations, &simple_dir_inode_operations,
&data->perms); &data->perms);
if (unlikely(!inode)) sb->s_root = d_make_root(inode);
if (unlikely(!sb->s_root))
goto Enomem; goto Enomem;
sb->s_root = d_alloc_root(inode);
if (unlikely(!sb->s_root)) {
iput(inode);
goto Enomem;
}
/* EP0 file */ /* EP0 file */
if (unlikely(!ffs_sb_create_file(sb, "ep0", ffs, if (unlikely(!ffs_sb_create_file(sb, "ep0", ffs,

Просмотреть файл

@ -2059,10 +2059,8 @@ gadgetfs_fill_super (struct super_block *sb, void *opts, int silent)
if (!inode) if (!inode)
goto Enomem; goto Enomem;
inode->i_op = &simple_dir_inode_operations; inode->i_op = &simple_dir_inode_operations;
if (!(sb->s_root = d_alloc_root (inode))) { if (!(sb->s_root = d_make_root (inode)))
iput(inode);
goto Enomem; goto Enomem;
}
/* the ep0 file is named after the controller we expect; /* the ep0 file is named after the controller we expect;
* user mode code can use it for sanity checks, like we do. * user mode code can use it for sanity checks, like we do.

Просмотреть файл

@ -155,9 +155,8 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags,
goto release_sb; goto release_sb;
} }
root = d_alloc_root(inode); root = d_make_root(inode);
if (!root) { if (!root) {
iput(inode);
retval = -ENOMEM; retval = -ENOMEM;
goto release_sb; goto release_sb;
} }

Просмотреть файл

@ -483,10 +483,9 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)
sb->s_d_op = &adfs_dentry_operations; sb->s_d_op = &adfs_dentry_operations;
root = adfs_iget(sb, &root_obj); root = adfs_iget(sb, &root_obj);
sb->s_root = d_alloc_root(root); sb->s_root = d_make_root(root);
if (!sb->s_root) { if (!sb->s_root) {
int i; int i;
iput(root);
for (i = 0; i < asb->s_map_size; i++) for (i = 0; i < asb->s_map_size; i++)
brelse(asb->s_map[i].dm_bh); brelse(asb->s_map[i].dm_bh);
kfree(asb->s_map); kfree(asb->s_map);

Просмотреть файл

@ -473,7 +473,7 @@ got_root:
root_inode = affs_iget(sb, root_block); root_inode = affs_iget(sb, root_block);
if (IS_ERR(root_inode)) { if (IS_ERR(root_inode)) {
ret = PTR_ERR(root_inode); ret = PTR_ERR(root_inode);
goto out_error_noinode; goto out_error;
} }
if (AFFS_SB(sb)->s_flags & SF_INTL) if (AFFS_SB(sb)->s_flags & SF_INTL)
@ -481,7 +481,7 @@ got_root:
else else
sb->s_d_op = &affs_dentry_operations; 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) { if (!sb->s_root) {
printk(KERN_ERR "AFFS: Get root inode failed\n"); printk(KERN_ERR "AFFS: Get root inode failed\n");
goto out_error; goto out_error;
@ -494,9 +494,6 @@ got_root:
* Begin the cascaded cleanup ... * Begin the cascaded cleanup ...
*/ */
out_error: out_error:
if (root_inode)
iput(root_inode);
out_error_noinode:
kfree(sbi->s_bitmap); kfree(sbi->s_bitmap);
affs_brelse(root_bh); affs_brelse(root_bh);
kfree(sbi->s_prefix); kfree(sbi->s_prefix);

Просмотреть файл

@ -301,7 +301,6 @@ static int afs_fill_super(struct super_block *sb,
{ {
struct afs_super_info *as = sb->s_fs_info; struct afs_super_info *as = sb->s_fs_info;
struct afs_fid fid; struct afs_fid fid;
struct dentry *root = NULL;
struct inode *inode = NULL; struct inode *inode = NULL;
int ret; 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); set_bit(AFS_VNODE_AUTOCELL, &AFS_FS_I(inode)->flags);
ret = -ENOMEM; ret = -ENOMEM;
root = d_alloc_root(inode); sb->s_root = d_make_root(inode);
if (!root) if (!sb->s_root)
goto error; goto error;
sb->s_d_op = &afs_fs_dentry_operations; sb->s_d_op = &afs_fs_dentry_operations;
sb->s_root = root;
_leave(" = 0"); _leave(" = 0");
return 0; return 0;
error: error:
iput(inode);
_leave(" = %d", ret); _leave(" = %d", ret);
return ret; return ret;
} }

Просмотреть файл

@ -247,12 +247,9 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
if (!ino) if (!ino)
goto fail_free; goto fail_free;
root_inode = autofs4_get_inode(s, S_IFDIR | 0755); root_inode = autofs4_get_inode(s, S_IFDIR | 0755);
if (!root_inode) root = d_make_root(root_inode);
goto fail_ino;
root = d_alloc_root(root_inode);
if (!root) if (!root)
goto fail_iput; goto fail_ino;
pipe = NULL; pipe = NULL;
root->d_fsdata = ino; root->d_fsdata = ino;
@ -317,9 +314,6 @@ fail_fput:
fail_dput: fail_dput:
dput(root); dput(root);
goto fail_free; goto fail_free;
fail_iput:
printk("autofs: get root dentry failed\n");
iput(root_inode);
fail_ino: fail_ino:
kfree(ino); kfree(ino);
fail_free: fail_free:

Просмотреть файл

@ -852,9 +852,8 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
ret = PTR_ERR(root); ret = PTR_ERR(root);
goto unacquire_priv_sbp; goto unacquire_priv_sbp;
} }
sb->s_root = d_alloc_root(root); sb->s_root = d_make_root(root);
if (!sb->s_root) { if (!sb->s_root) {
iput(root);
befs_error(sb, "get root inode failed"); befs_error(sb, "get root inode failed");
goto unacquire_priv_sbp; goto unacquire_priv_sbp;
} }

Просмотреть файл

@ -367,9 +367,8 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
ret = PTR_ERR(inode); ret = PTR_ERR(inode);
goto out2; goto out2;
} }
s->s_root = d_alloc_root(inode); s->s_root = d_make_root(inode);
if (!s->s_root) { if (!s->s_root) {
iput(inode);
ret = -ENOMEM; ret = -ENOMEM;
goto out2; goto out2;
} }

Просмотреть файл

@ -629,7 +629,6 @@ static int btrfs_fill_super(struct super_block *sb,
void *data, int silent) void *data, int silent)
{ {
struct inode *inode; struct inode *inode;
struct dentry *root_dentry;
struct btrfs_fs_info *fs_info = btrfs_sb(sb); struct btrfs_fs_info *fs_info = btrfs_sb(sb);
struct btrfs_key key; struct btrfs_key key;
int err; int err;
@ -660,15 +659,12 @@ static int btrfs_fill_super(struct super_block *sb,
goto fail_close; goto fail_close;
} }
root_dentry = d_alloc_root(inode); sb->s_root = d_make_root(inode);
if (!root_dentry) { if (!sb->s_root) {
iput(inode);
err = -ENOMEM; err = -ENOMEM;
goto fail_close; goto fail_close;
} }
sb->s_root = root_dentry;
save_mount_options(sb, data); save_mount_options(sb, data);
cleancache_init_fs(sb); cleancache_init_fs(sb);
sb->s_flags |= MS_ACTIVE; sb->s_flags |= MS_ACTIVE;

Просмотреть файл

@ -655,9 +655,8 @@ static struct dentry *open_root_dentry(struct ceph_fs_client *fsc,
dout("open_root_inode success\n"); dout("open_root_inode success\n");
if (ceph_ino(inode) == CEPH_INO_ROOT && if (ceph_ino(inode) == CEPH_INO_ROOT &&
fsc->sb->s_root == NULL) { fsc->sb->s_root == NULL) {
root = d_alloc_root(inode); root = d_make_root(inode);
if (!root) { if (!root) {
iput(inode);
root = ERR_PTR(-ENOMEM); root = ERR_PTR(-ENOMEM);
goto out; goto out;
} }

Просмотреть файл

@ -122,11 +122,9 @@ cifs_read_super(struct super_block *sb)
goto out_no_root; goto out_no_root;
} }
sb->s_root = d_alloc_root(inode); sb->s_root = d_make_root(inode);
if (!sb->s_root) { if (!sb->s_root) {
rc = -ENOMEM; rc = -ENOMEM;
iput(inode);
goto out_no_root; goto out_no_root;
} }

Просмотреть файл

@ -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", printk("coda_read_super: rootinode is %ld dev %s\n",
root->i_ino, root->i_sb->s_id); 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) { if (!sb->s_root) {
iput(root);
error = -EINVAL; error = -EINVAL;
goto error; goto error;
} }

Просмотреть файл

@ -91,10 +91,9 @@ static int configfs_fill_super(struct super_block *sb, void *data, int silent)
return -ENOMEM; return -ENOMEM;
} }
root = d_alloc_root(inode); root = d_make_root(inode);
if (!root) { if (!root) {
pr_debug("%s: could not get root dentry!\n",__func__); pr_debug("%s: could not get root dentry!\n",__func__);
iput(inode);
return -ENOMEM; return -ENOMEM;
} }
config_group_init(&configfs_root_group); config_group_init(&configfs_root_group);

Просмотреть файл

@ -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); root = get_cramfs_inode(sb, &super.root, 0);
if (IS_ERR(root)) if (IS_ERR(root))
goto out; goto out;
sb->s_root = d_alloc_root(root); sb->s_root = d_make_root(root);
if (!sb->s_root) { if (!sb->s_root)
iput(root);
goto out; goto out;
}
return 0; return 0;
out: out:
kfree(sbi); kfree(sbi);

Просмотреть файл

@ -309,12 +309,11 @@ devpts_fill_super(struct super_block *s, void *data, int silent)
inode->i_fop = &simple_dir_operations; inode->i_fop = &simple_dir_operations;
set_nlink(inode, 2); set_nlink(inode, 2);
s->s_root = d_alloc_root(inode); s->s_root = d_make_root(inode);
if (s->s_root) if (s->s_root)
return 0; return 0;
printk(KERN_ERR "devpts: get root dentry failed\n"); printk(KERN_ERR "devpts: get root dentry failed\n");
iput(inode);
fail: fail:
return -ENOMEM; return -ENOMEM;

Просмотреть файл

@ -550,9 +550,8 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags
if (IS_ERR(inode)) if (IS_ERR(inode))
goto out_free; goto out_free;
s->s_root = d_alloc_root(inode); s->s_root = d_make_root(inode);
if (!s->s_root) { if (!s->s_root) {
iput(inode);
rc = -ENOMEM; rc = -ENOMEM;
goto out_free; goto out_free;
} }

Просмотреть файл

@ -317,10 +317,9 @@ static int efs_fill_super(struct super_block *s, void *d, int silent)
goto out_no_fs; goto out_no_fs;
} }
s->s_root = d_alloc_root(root); s->s_root = d_make_root(root);
if (!(s->s_root)) { if (!(s->s_root)) {
printk(KERN_ERR "EFS: get root dentry failed\n"); printk(KERN_ERR "EFS: get root dentry failed\n");
iput(root);
ret = -ENOMEM; ret = -ENOMEM;
goto out_no_fs; goto out_no_fs;
} }

Просмотреть файл

@ -819,9 +819,8 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent)
ret = PTR_ERR(root); ret = PTR_ERR(root);
goto free_sbi; goto free_sbi;
} }
sb->s_root = d_alloc_root(root); sb->s_root = d_make_root(root);
if (!sb->s_root) { if (!sb->s_root) {
iput(root);
EXOFS_ERR("ERROR: get root inode failed\n"); EXOFS_ERR("ERROR: get root inode failed\n");
ret = -ENOMEM; ret = -ENOMEM;
goto free_sbi; goto free_sbi;

Просмотреть файл

@ -1088,9 +1088,8 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
goto failed_mount3; goto failed_mount3;
} }
sb->s_root = d_alloc_root(root); sb->s_root = d_make_root(root);
if (!sb->s_root) { if (!sb->s_root) {
iput(root);
ext2_msg(sb, KERN_ERR, "error: get root inode failed"); ext2_msg(sb, KERN_ERR, "error: get root inode failed");
ret = -ENOMEM; ret = -ENOMEM;
goto failed_mount3; goto failed_mount3;

Просмотреть файл

@ -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"); ext3_msg(sb, KERN_ERR, "error: corrupt root inode, run e2fsck");
goto failed_mount3; goto failed_mount3;
} }
sb->s_root = d_alloc_root(root); sb->s_root = d_make_root(root);
if (!sb->s_root) { if (!sb->s_root) {
ext3_msg(sb, KERN_ERR, "error: get root dentry failed"); ext3_msg(sb, KERN_ERR, "error: get root dentry failed");
iput(root);
ret = -ENOMEM; ret = -ENOMEM;
goto failed_mount3; goto failed_mount3;
} }

Просмотреть файл

@ -3735,9 +3735,8 @@ no_journal:
iput(root); iput(root);
goto failed_mount4; goto failed_mount4;
} }
sb->s_root = d_alloc_root(root); sb->s_root = d_make_root(root);
if (!sb->s_root) { if (!sb->s_root) {
iput(root);
ext4_msg(sb, KERN_ERR, "get root dentry failed"); ext4_msg(sb, KERN_ERR, "get root dentry failed");
ret = -ENOMEM; ret = -ENOMEM;
goto failed_mount4; goto failed_mount4;

Просмотреть файл

@ -224,9 +224,8 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent)
ret = PTR_ERR(root); ret = PTR_ERR(root);
goto out; goto out;
} }
sbp->s_root = d_alloc_root(root); sbp->s_root = d_make_root(root);
if (!sbp->s_root) { if (!sbp->s_root) {
iput(root);
printk(KERN_WARNING "vxfs: unable to get root dentry.\n"); printk(KERN_WARNING "vxfs: unable to get root dentry.\n");
goto out_free_ilist; goto out_free_ilist;
} }

Просмотреть файл

@ -988,14 +988,9 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
err = -ENOMEM; err = -ENOMEM;
root = fuse_get_root_inode(sb, d.rootmode); root = fuse_get_root_inode(sb, d.rootmode);
if (!root) root_dentry = d_make_root(root);
if (!root_dentry)
goto err_put_conn; 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 */ /* only now - we want root dentry with NULL ->d_op */
sb->s_d_op = &fuse_dentry_operations; sb->s_d_op = &fuse_dentry_operations;

Просмотреть файл

@ -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)); fs_err(sdp, "can't read in %s inode: %ld\n", name, PTR_ERR(inode));
return PTR_ERR(inode); return PTR_ERR(inode);
} }
dentry = d_alloc_root(inode); dentry = d_make_root(inode);
if (!dentry) { if (!dentry) {
fs_err(sdp, "can't alloc %s dentry\n", name); fs_err(sdp, "can't alloc %s dentry\n", name);
iput(inode);
return -ENOMEM; return -ENOMEM;
} }
*dptr = dentry; *dptr = dentry;

Просмотреть файл

@ -430,15 +430,13 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent)
sb->s_d_op = &hfs_dentry_operations; sb->s_d_op = &hfs_dentry_operations;
res = -ENOMEM; res = -ENOMEM;
sb->s_root = d_alloc_root(root_inode); sb->s_root = d_make_root(root_inode);
if (!sb->s_root) if (!sb->s_root)
goto bail_iput; goto bail_no_root;
/* everything's okay */ /* everything's okay */
return 0; return 0;
bail_iput:
iput(root_inode);
bail_no_root: bail_no_root:
printk(KERN_ERR "hfs: get root inode failed.\n"); printk(KERN_ERR "hfs: get root inode failed.\n");
bail: bail:

Просмотреть файл

@ -966,9 +966,9 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
} }
err = -ENOMEM; err = -ENOMEM;
sb->s_root = d_alloc_root(root_inode); sb->s_root = d_make_root(root_inode);
if (sb->s_root == NULL) if (sb->s_root == NULL)
goto out_put; goto out;
return 0; return 0;

Просмотреть файл

@ -625,11 +625,9 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
hpfs_init_inode(root); hpfs_init_inode(root);
hpfs_read_inode(root); hpfs_read_inode(root);
unlock_new_inode(root); unlock_new_inode(root);
s->s_root = d_alloc_root(root); s->s_root = d_make_root(root);
if (!s->s_root) { if (!s->s_root)
iput(root);
goto bail0; goto bail0;
}
/* /*
* find the root directory's . pointer & finish filling in the inode * find the root directory's . pointer & finish filling in the inode

Просмотреть файл

@ -726,17 +726,12 @@ static int hppfs_fill_super(struct super_block *sb, void *d, int silent)
err = -ENOMEM; err = -ENOMEM;
root_inode = get_inode(sb, dget(proc_mnt->mnt_root)); root_inode = get_inode(sb, dget(proc_mnt->mnt_root));
if (!root_inode) sb->s_root = d_make_root(root_inode);
goto out_mntput;
sb->s_root = d_alloc_root(root_inode);
if (!sb->s_root) if (!sb->s_root)
goto out_iput; goto out_mntput;
return 0; return 0;
out_iput:
iput(root_inode);
out_mntput: out_mntput:
mntput(proc_mnt); mntput(proc_mnt);
out: out:

Просмотреть файл

@ -831,8 +831,6 @@ bad_val:
static int static int
hugetlbfs_fill_super(struct super_block *sb, void *data, int silent) hugetlbfs_fill_super(struct super_block *sb, void *data, int silent)
{ {
struct inode * inode;
struct dentry * root;
int ret; int ret;
struct hugetlbfs_config config; struct hugetlbfs_config config;
struct hugetlbfs_sb_info *sbinfo; 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_magic = HUGETLBFS_MAGIC;
sb->s_op = &hugetlbfs_ops; sb->s_op = &hugetlbfs_ops;
sb->s_time_gran = 1; sb->s_time_gran = 1;
inode = hugetlbfs_get_root(sb, &config); sb->s_root = d_make_root(hugetlbfs_get_root(sb, &config));
if (!inode) if (!sb->s_root)
goto out_free; goto out_free;
root = d_alloc_root(inode);
if (!root) {
iput(inode);
goto out_free;
}
sb->s_root = root;
return 0; return 0;
out_free: out_free:
kfree(sbinfo); kfree(sbinfo);

Просмотреть файл

@ -947,9 +947,8 @@ root_found:
s->s_d_op = &isofs_dentry_ops[table]; s->s_d_op = &isofs_dentry_ops[table];
/* get the root dentry */ /* get the root dentry */
s->s_root = d_alloc_root(inode); s->s_root = d_make_root(inode);
if (!(s->s_root)) { if (!(s->s_root)) {
iput(inode);
error = -ENOMEM; error = -ENOMEM;
goto out_no_inode; goto out_no_inode;
} }

Просмотреть файл

@ -561,9 +561,9 @@ int jffs2_do_fill_super(struct super_block *sb, void *data, int silent)
ret = -ENOMEM; ret = -ENOMEM;
D1(printk(KERN_DEBUG "jffs2_do_fill_super(): d_alloc_root()\n")); 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) if (!sb->s_root)
goto out_root_i; goto out_root;
sb->s_maxbytes = 0xFFFFFFFF; sb->s_maxbytes = 0xFFFFFFFF;
sb->s_blocksize = PAGE_CACHE_SIZE; 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); jffs2_start_garbage_collect_thread(c);
return 0; return 0;
out_root_i:
iput(root_i);
out_root: out_root:
jffs2_free_ino_caches(c); jffs2_free_ino_caches(c);
jffs2_free_raw_node_refs(c); jffs2_free_raw_node_refs(c);

Просмотреть файл

@ -522,7 +522,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
ret = PTR_ERR(inode); ret = PTR_ERR(inode);
goto out_no_rw; goto out_no_rw;
} }
sb->s_root = d_alloc_root(inode); sb->s_root = d_make_root(inode);
if (!sb->s_root) if (!sb->s_root)
goto out_no_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: out_no_root:
jfs_err("jfs_read_super: get root dentry failed"); jfs_err("jfs_read_super: get root dentry failed");
iput(inode);
out_no_rw: out_no_rw:
rc = jfs_umount(sb); rc = jfs_umount(sb);

Просмотреть файл

@ -491,11 +491,9 @@ int simple_fill_super(struct super_block *s, unsigned long magic,
inode->i_op = &simple_dir_inode_operations; inode->i_op = &simple_dir_inode_operations;
inode->i_fop = &simple_dir_operations; inode->i_fop = &simple_dir_operations;
set_nlink(inode, 2); set_nlink(inode, 2);
root = d_alloc_root(inode); root = d_make_root(inode);
if (!root) { if (!root)
iput(inode);
return -ENOMEM; return -ENOMEM;
}
for (i = 0; !files->name || files->name[0]; i++, files++) { for (i = 0; !files->name || files->name[0]; i++, files++) {
if (!files->name) if (!files->name)
continue; continue;

Просмотреть файл

@ -315,11 +315,9 @@ static int logfs_get_sb_final(struct super_block *sb)
if (IS_ERR(rootdir)) if (IS_ERR(rootdir))
goto fail; goto fail;
sb->s_root = d_alloc_root(rootdir); sb->s_root = d_make_root(rootdir);
if (!sb->s_root) { if (!sb->s_root)
iput(rootdir);
goto fail; goto fail;
}
/* at that point we know that ->put_super() will be called */ /* at that point we know that ->put_super() will be called */
super->s_erase_page = alloc_pages(GFP_KERNEL, 0); super->s_erase_page = alloc_pages(GFP_KERNEL, 0);

Просмотреть файл

@ -716,13 +716,11 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
if (!root_inode) if (!root_inode)
goto out_disconnect; goto out_disconnect;
DPRINTK("ncp_fill_super: root vol=%d\n", NCP_FINFO(root_inode)->volNumber); 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) if (!sb->s_root)
goto out_no_root; goto out_disconnect;
return 0; return 0;
out_no_root:
iput(root_inode);
out_disconnect: out_disconnect:
ncp_lock_server(server); ncp_lock_server(server);
ncp_disconnect(server); ncp_disconnect(server);

Просмотреть файл

@ -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 */ /* The mntroot acts as the dummy root dentry for this superblock */
if (sb->s_root == NULL) { if (sb->s_root == NULL) {
sb->s_root = d_alloc_root(inode); sb->s_root = d_make_root(inode);
if (sb->s_root == NULL) { if (sb->s_root == NULL)
iput(inode);
return -ENOMEM; return -ENOMEM;
}
ihold(inode); ihold(inode);
/* /*
* Ensure that this dentry is invisible to d_find_alias(). * Ensure that this dentry is invisible to d_find_alias().

Просмотреть файл

@ -917,9 +917,8 @@ static int nilfs_get_root_dentry(struct super_block *sb,
if (root->cno == NILFS_CPTREE_CURRENT_CNO) { if (root->cno == NILFS_CPTREE_CURRENT_CNO) {
dentry = d_find_alias(inode); dentry = d_find_alias(inode);
if (!dentry) { if (!dentry) {
dentry = d_alloc_root(inode); dentry = d_make_root(inode);
if (!dentry) { if (!dentry) {
iput(inode);
ret = -ENOMEM; ret = -ENOMEM;
goto failed_dentry; goto failed_dentry;
} }

Просмотреть файл

@ -582,24 +582,14 @@ static int dlmfs_fill_super(struct super_block * sb,
void * data, void * data,
int silent) int silent)
{ {
struct inode * inode;
struct dentry * root;
sb->s_maxbytes = MAX_LFS_FILESIZE; sb->s_maxbytes = MAX_LFS_FILESIZE;
sb->s_blocksize = PAGE_CACHE_SIZE; sb->s_blocksize = PAGE_CACHE_SIZE;
sb->s_blocksize_bits = PAGE_CACHE_SHIFT; sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
sb->s_magic = DLMFS_MAGIC; sb->s_magic = DLMFS_MAGIC;
sb->s_op = &dlmfs_ops; sb->s_op = &dlmfs_ops;
inode = dlmfs_get_root_inode(sb); sb->s_root = d_make_root(dlmfs_get_root_inode(sb));
if (!inode) if (!sb->s_root)
return -ENOMEM; return -ENOMEM;
root = d_alloc_root(inode);
if (!root) {
iput(inode);
return -ENOMEM;
}
sb->s_root = root;
return 0; return 0;
} }

Просмотреть файл

@ -1166,9 +1166,8 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
goto read_super_error; goto read_super_error;
} }
root = d_alloc_root(inode); root = d_make_root(inode);
if (!root) { if (!root) {
iput(inode);
status = -ENOMEM; status = -ENOMEM;
mlog_errno(status); mlog_errno(status);
goto read_super_error; goto read_super_error;

Просмотреть файл

@ -539,11 +539,9 @@ static int omfs_fill_super(struct super_block *sb, void *data, int silent)
goto out_brelse_bh2; goto out_brelse_bh2;
} }
sb->s_root = d_alloc_root(root); sb->s_root = d_make_root(root);
if (!sb->s_root) { if (!sb->s_root)
iput(root);
goto out_brelse_bh2; goto out_brelse_bh2;
}
printk(KERN_DEBUG "omfs: Mounted volume %s\n", omfs_rb->r_name); printk(KERN_DEBUG "omfs: Mounted volume %s\n", omfs_rb->r_name);
ret = 0; ret = 0;

Просмотреть файл

@ -408,13 +408,12 @@ static int openprom_fill_super(struct super_block *s, void *data, int silent)
oi->type = op_inode_node; oi->type = op_inode_node;
oi->u.node = of_find_node_by_path("/"); 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) if (!s->s_root)
goto out_no_root_dentry; goto out_no_root_dentry;
return 0; return 0;
out_no_root_dentry: out_no_root_dentry:
iput(root_inode);
ret = -ENOMEM; ret = -ENOMEM;
out_no_root: out_no_root:
printk("openprom_fill_super: get root inode failed\n"); printk("openprom_fill_super: get root inode failed\n");

Просмотреть файл

@ -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) int proc_fill_super(struct super_block *s)
{ {
struct inode * root_inode;
s->s_flags |= MS_NODIRATIME | MS_NOSUID | MS_NOEXEC; s->s_flags |= MS_NODIRATIME | MS_NOSUID | MS_NOEXEC;
s->s_blocksize = 1024; s->s_blocksize = 1024;
s->s_blocksize_bits = 10; s->s_blocksize_bits = 10;
@ -496,17 +494,10 @@ int proc_fill_super(struct super_block *s)
s->s_time_gran = 1; s->s_time_gran = 1;
pde_get(&proc_root); pde_get(&proc_root);
root_inode = proc_get_inode(s, &proc_root); s->s_root = d_make_root(proc_get_inode(s, &proc_root));
if (!root_inode) if (s->s_root)
goto out_no_root; return 0;
s->s_root = d_alloc_root(root_inode);
if (!s->s_root) {
iput(root_inode);
goto out_no_root;
}
return 0;
out_no_root:
printk("proc_read_super: get root inode failed\n"); printk("proc_read_super: get root inode failed\n");
pde_put(&proc_root); pde_put(&proc_root);
return -ENOMEM; return -ENOMEM;

Просмотреть файл

@ -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) */ /* override ramfs "dir" options so we catch unlink(2) */
inode->i_op = &pstore_dir_inode_operations; inode->i_op = &pstore_dir_inode_operations;
root = d_alloc_root(inode); root = d_make_root(inode);
sb->s_root = root; sb->s_root = root;
if (!root) { if (!root) {
err = -ENOMEM; err = -ENOMEM;
@ -314,7 +314,6 @@ int pstore_fill_super(struct super_block *sb, void *data, int silent)
return 0; return 0;
fail: fail:
iput(inode);
return err; return err;
} }

Просмотреть файл

@ -260,15 +260,13 @@ static int qnx4_fill_super(struct super_block *s, void *data, int silent)
} }
ret = -ENOMEM; ret = -ENOMEM;
s->s_root = d_alloc_root(root); s->s_root = d_make_root(root);
if (s->s_root == NULL) if (s->s_root == NULL)
goto outi; goto outb;
brelse(bh); brelse(bh);
return 0; return 0;
outi:
iput(root);
outb: outb:
kfree(qs->BitMap); kfree(qs->BitMap);
out: out:

Просмотреть файл

@ -210,7 +210,6 @@ int ramfs_fill_super(struct super_block *sb, void *data, int silent)
{ {
struct ramfs_fs_info *fsi; struct ramfs_fs_info *fsi;
struct inode *inode = NULL; struct inode *inode = NULL;
struct dentry *root;
int err; int err;
save_mount_options(sb, data); 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; sb->s_time_gran = 1;
inode = ramfs_get_inode(sb, NULL, S_IFDIR | fsi->mount_opts.mode, 0); inode = ramfs_get_inode(sb, NULL, S_IFDIR | fsi->mount_opts.mode, 0);
if (!inode) { sb->s_root = d_make_root(inode);
err = -ENOMEM; if (!sb->s_root) {
goto fail;
}
root = d_alloc_root(inode);
sb->s_root = root;
if (!root) {
err = -ENOMEM; err = -ENOMEM;
goto fail; goto fail;
} }
@ -250,7 +243,6 @@ int ramfs_fill_super(struct super_block *sb, void *data, int silent)
fail: fail:
kfree(fsi); kfree(fsi);
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
iput(inode);
return err; return err;
} }

Просмотреть файл

@ -1874,11 +1874,9 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
unlock_new_inode(root_inode); unlock_new_inode(root_inode);
} }
s->s_root = d_alloc_root(root_inode); s->s_root = d_make_root(root_inode);
if (!s->s_root) { if (!s->s_root)
iput(root_inode);
goto error; goto error;
}
// define and initialize hash function // define and initialize hash function
sbi->s_hash_function = hash_function(s); sbi->s_hash_function = hash_function(s);
if (sbi->s_hash_function == NULL) { if (sbi->s_hash_function == NULL) {

Просмотреть файл

@ -538,14 +538,12 @@ static int romfs_fill_super(struct super_block *sb, void *data, int silent)
if (IS_ERR(root)) if (IS_ERR(root))
goto error; goto error;
sb->s_root = d_alloc_root(root); sb->s_root = d_make_root(root);
if (!sb->s_root) if (!sb->s_root)
goto error_i; goto error;
return 0; return 0;
error_i:
iput(root);
error: error:
return -EINVAL; return -EINVAL;
error_rsb_inval: error_rsb_inval:

Просмотреть файл

@ -316,11 +316,10 @@ check_directory_table:
} }
insert_inode_hash(root); insert_inode_hash(root);
sb->s_root = d_alloc_root(root); sb->s_root = d_make_root(root);
if (sb->s_root == NULL) { if (sb->s_root == NULL) {
ERROR("Root inode create failed\n"); ERROR("Root inode create failed\n");
err = -ENOMEM; err = -ENOMEM;
iput(root);
goto failed_mount; goto failed_mount;
} }

Просмотреть файл

@ -61,10 +61,9 @@ static int sysfs_fill_super(struct super_block *sb, void *data, int silent)
} }
/* instantiate and link root dentry */ /* instantiate and link root dentry */
root = d_alloc_root(inode); root = d_make_root(inode);
if (!root) { if (!root) {
pr_debug("%s: could not get root dentry!\n",__func__); pr_debug("%s: could not get root dentry!\n",__func__);
iput(inode);
return -ENOMEM; return -ENOMEM;
} }
root->d_fsdata = &sysfs_root; root->d_fsdata = &sysfs_root;

Просмотреть файл

@ -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"); printk("SysV FS: get root inode failed\n");
return 0; return 0;
} }
sb->s_root = d_alloc_root(root_inode); sb->s_root = d_make_root(root_inode);
if (!sb->s_root) { if (!sb->s_root) {
iput(root_inode);
printk("SysV FS: get root dentry failed\n"); printk("SysV FS: get root dentry failed\n");
return 0; return 0;
} }

Просмотреть файл

@ -2076,15 +2076,13 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent)
goto out_umount; goto out_umount;
} }
sb->s_root = d_alloc_root(root); sb->s_root = d_make_root(root);
if (!sb->s_root) if (!sb->s_root)
goto out_iput; goto out_umount;
mutex_unlock(&c->umount_mutex); mutex_unlock(&c->umount_mutex);
return 0; return 0;
out_iput:
iput(root);
out_umount: out_umount:
ubifs_umount(c); ubifs_umount(c);
out_unlock: out_unlock:

Просмотреть файл

@ -2037,10 +2037,9 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
} }
/* Allocate a dentry for the root inode */ /* 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) { if (!sb->s_root) {
udf_err(sb, "Couldn't allocate root dentry\n"); udf_err(sb, "Couldn't allocate root dentry\n");
iput(inode);
goto error_out; goto error_out;
} }
sb->s_maxbytes = MAX_LFS_FILESIZE; sb->s_maxbytes = MAX_LFS_FILESIZE;

Просмотреть файл

@ -1164,10 +1164,10 @@ magic_found:
ret = PTR_ERR(inode); ret = PTR_ERR(inode);
goto failed; goto failed;
} }
sb->s_root = d_alloc_root(inode); sb->s_root = d_make_root(inode);
if (!sb->s_root) { if (!sb->s_root) {
ret = -ENOMEM; ret = -ENOMEM;
goto dalloc_failed; goto failed;
} }
ufs_setup_cstotal(sb); ufs_setup_cstotal(sb);
@ -1181,8 +1181,6 @@ magic_found:
UFSD("EXIT\n"); UFSD("EXIT\n");
return 0; return 0;
dalloc_failed:
iput(inode);
failed: failed:
if (ubh) if (ubh)
ubh_brelse_uspi (uspi); ubh_brelse_uspi (uspi);

Просмотреть файл

@ -1362,10 +1362,10 @@ xfs_fs_fill_super(
error = EINVAL; error = EINVAL;
goto out_syncd_stop; goto out_syncd_stop;
} }
sb->s_root = d_alloc_root(root); sb->s_root = d_make_root(root);
if (!sb->s_root) { if (!sb->s_root) {
error = ENOMEM; error = ENOMEM;
goto out_iput; goto out_syncd_stop;
} }
return 0; return 0;
@ -1384,8 +1384,6 @@ xfs_fs_fill_super(
out: out:
return -error; return -error;
out_iput:
iput(root);
out_syncd_stop: out_syncd_stop:
xfs_syncd_stop(mp); xfs_syncd_stop(mp);
out_unmount: out_unmount:

Просмотреть файл

@ -188,30 +188,20 @@ static int mqueue_fill_super(struct super_block *sb, void *data, int silent)
{ {
struct inode *inode; struct inode *inode;
struct ipc_namespace *ns = data; struct ipc_namespace *ns = data;
int error;
sb->s_blocksize = PAGE_CACHE_SIZE; sb->s_blocksize = PAGE_CACHE_SIZE;
sb->s_blocksize_bits = PAGE_CACHE_SHIFT; sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
sb->s_magic = MQUEUE_MAGIC; sb->s_magic = MQUEUE_MAGIC;
sb->s_op = &mqueue_super_ops; sb->s_op = &mqueue_super_ops;
inode = mqueue_get_inode(sb, ns, S_IFDIR | S_ISVTX | S_IRWXUGO, inode = mqueue_get_inode(sb, ns, S_IFDIR | S_ISVTX | S_IRWXUGO, NULL);
NULL); if (IS_ERR(inode))
if (IS_ERR(inode)) { return PTR_ERR(inode);
error = PTR_ERR(inode);
goto out;
}
sb->s_root = d_alloc_root(inode); sb->s_root = d_make_root(inode);
if (!sb->s_root) { if (!sb->s_root)
iput(inode); return -ENOMEM;
error = -ENOMEM; return 0;
goto out;
}
error = 0;
out:
return error;
} }
static struct dentry *mqueue_mount(struct file_system_type *fs_type, static struct dentry *mqueue_mount(struct file_system_type *fs_type,

Просмотреть файл

@ -1472,7 +1472,6 @@ static int cgroup_get_rootdir(struct super_block *sb)
struct inode *inode = struct inode *inode =
cgroup_new_inode(S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR, sb); cgroup_new_inode(S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR, sb);
struct dentry *dentry;
if (!inode) if (!inode)
return -ENOMEM; return -ENOMEM;
@ -1481,12 +1480,9 @@ static int cgroup_get_rootdir(struct super_block *sb)
inode->i_op = &cgroup_dir_inode_operations; inode->i_op = &cgroup_dir_inode_operations;
/* directories start off with i_nlink == 2 (for "." entry) */ /* directories start off with i_nlink == 2 (for "." entry) */
inc_nlink(inode); inc_nlink(inode);
dentry = d_alloc_root(inode); sb->s_root = d_make_root(inode);
if (!dentry) { if (!sb->s_root)
iput(inode);
return -ENOMEM; return -ENOMEM;
}
sb->s_root = dentry;
/* for everything else we want ->d_op set */ /* for everything else we want ->d_op set */
sb->s_d_op = &cgroup_dops; sb->s_d_op = &cgroup_dops;
return 0; return 0;

Просмотреть файл

@ -2232,14 +2232,12 @@ int shmem_fill_super(struct super_block *sb, void *data, int silent)
goto failed; goto failed;
inode->i_uid = sbinfo->uid; inode->i_uid = sbinfo->uid;
inode->i_gid = sbinfo->gid; inode->i_gid = sbinfo->gid;
root = d_alloc_root(inode); root = d_make_root(inode);
if (!root) if (!root)
goto failed_iput; goto failed;
sb->s_root = root; sb->s_root = root;
return 0; return 0;
failed_iput:
iput(inode);
failed: failed:
shmem_put_super(sb); shmem_put_super(sb);
return err; return err;

Просмотреть файл

@ -1033,13 +1033,9 @@ rpc_fill_super(struct super_block *sb, void *data, int silent)
sb->s_time_gran = 1; sb->s_time_gran = 1;
inode = rpc_get_inode(sb, S_IFDIR | 0755); inode = rpc_get_inode(sb, S_IFDIR | 0755);
if (!inode) sb->s_root = root = d_make_root(inode);
if (!root)
return -ENOMEM; return -ENOMEM;
sb->s_root = root = d_alloc_root(inode);
if (!root) {
iput(inode);
return -ENOMEM;
}
if (rpc_populate(root, files, RPCAUTH_lockd, RPCAUTH_RootEOF, NULL)) if (rpc_populate(root, files, RPCAUTH_lockd, RPCAUTH_RootEOF, NULL))
return -ENOMEM; return -ENOMEM;
return 0; return 0;