get rid of useless dget_parent() in fs/btrfs/ioctl.c
both callers there have dentry->d_parent stabilized by the fact that their caller had obtained dentry from lookup_one_len() and had not dropped ->i_mutex on parent since then. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
02c24a8218
commit
2fbe8c8ad1
@ -323,7 +323,7 @@ static noinline int create_subvol(struct btrfs_root *root,
|
|||||||
struct btrfs_inode_item *inode_item;
|
struct btrfs_inode_item *inode_item;
|
||||||
struct extent_buffer *leaf;
|
struct extent_buffer *leaf;
|
||||||
struct btrfs_root *new_root;
|
struct btrfs_root *new_root;
|
||||||
struct dentry *parent = dget_parent(dentry);
|
struct dentry *parent = dentry->d_parent;
|
||||||
struct inode *dir;
|
struct inode *dir;
|
||||||
int ret;
|
int ret;
|
||||||
int err;
|
int err;
|
||||||
@ -332,10 +332,8 @@ static noinline int create_subvol(struct btrfs_root *root,
|
|||||||
u64 index = 0;
|
u64 index = 0;
|
||||||
|
|
||||||
ret = btrfs_find_free_objectid(root->fs_info->tree_root, &objectid);
|
ret = btrfs_find_free_objectid(root->fs_info->tree_root, &objectid);
|
||||||
if (ret) {
|
if (ret)
|
||||||
dput(parent);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
|
||||||
|
|
||||||
dir = parent->d_inode;
|
dir = parent->d_inode;
|
||||||
|
|
||||||
@ -346,10 +344,8 @@ static noinline int create_subvol(struct btrfs_root *root,
|
|||||||
* 2 - dir items
|
* 2 - dir items
|
||||||
*/
|
*/
|
||||||
trans = btrfs_start_transaction(root, 6);
|
trans = btrfs_start_transaction(root, 6);
|
||||||
if (IS_ERR(trans)) {
|
if (IS_ERR(trans))
|
||||||
dput(parent);
|
|
||||||
return PTR_ERR(trans);
|
return PTR_ERR(trans);
|
||||||
}
|
|
||||||
|
|
||||||
leaf = btrfs_alloc_free_block(trans, root, root->leafsize,
|
leaf = btrfs_alloc_free_block(trans, root, root->leafsize,
|
||||||
0, objectid, NULL, 0, 0, 0);
|
0, objectid, NULL, 0, 0, 0);
|
||||||
@ -439,7 +435,6 @@ static noinline int create_subvol(struct btrfs_root *root,
|
|||||||
|
|
||||||
d_instantiate(dentry, btrfs_lookup_dentry(dir, dentry));
|
d_instantiate(dentry, btrfs_lookup_dentry(dir, dentry));
|
||||||
fail:
|
fail:
|
||||||
dput(parent);
|
|
||||||
if (async_transid) {
|
if (async_transid) {
|
||||||
*async_transid = trans->transid;
|
*async_transid = trans->transid;
|
||||||
err = btrfs_commit_transaction_async(trans, root, 1);
|
err = btrfs_commit_transaction_async(trans, root, 1);
|
||||||
@ -456,7 +451,6 @@ static int create_snapshot(struct btrfs_root *root, struct dentry *dentry,
|
|||||||
bool readonly)
|
bool readonly)
|
||||||
{
|
{
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
struct dentry *parent;
|
|
||||||
struct btrfs_pending_snapshot *pending_snapshot;
|
struct btrfs_pending_snapshot *pending_snapshot;
|
||||||
struct btrfs_trans_handle *trans;
|
struct btrfs_trans_handle *trans;
|
||||||
int ret;
|
int ret;
|
||||||
@ -504,9 +498,7 @@ static int create_snapshot(struct btrfs_root *root, struct dentry *dentry,
|
|||||||
if (ret)
|
if (ret)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
parent = dget_parent(dentry);
|
inode = btrfs_lookup_dentry(dentry->d_parent->d_inode, dentry);
|
||||||
inode = btrfs_lookup_dentry(parent->d_inode, dentry);
|
|
||||||
dput(parent);
|
|
||||||
if (IS_ERR(inode)) {
|
if (IS_ERR(inode)) {
|
||||||
ret = PTR_ERR(inode);
|
ret = PTR_ERR(inode);
|
||||||
goto fail;
|
goto fail;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user