Commit b42b90d1 authored by Al Viro's avatar Al Viro

ceph: fix d_obtain_alias() misuses

on failure d_obtain_alias() will have done iput()
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent ebaaa80e
...@@ -95,10 +95,8 @@ static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino) ...@@ -95,10 +95,8 @@ static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino)
} }
dentry = d_obtain_alias(inode); dentry = d_obtain_alias(inode);
if (IS_ERR(dentry)) { if (IS_ERR(dentry))
iput(inode);
return dentry; return dentry;
}
err = ceph_init_dentry(dentry); err = ceph_init_dentry(dentry);
if (err < 0) { if (err < 0) {
dput(dentry); dput(dentry);
...@@ -167,10 +165,8 @@ static struct dentry *__get_parent(struct super_block *sb, ...@@ -167,10 +165,8 @@ static struct dentry *__get_parent(struct super_block *sb,
return ERR_PTR(-ENOENT); return ERR_PTR(-ENOENT);
dentry = d_obtain_alias(inode); dentry = d_obtain_alias(inode);
if (IS_ERR(dentry)) { if (IS_ERR(dentry))
iput(inode);
return dentry; return dentry;
}
err = ceph_init_dentry(dentry); err = ceph_init_dentry(dentry);
if (err < 0) { if (err < 0) {
dput(dentry); dput(dentry);
...@@ -210,7 +206,7 @@ static struct dentry *ceph_fh_to_parent(struct super_block *sb, ...@@ -210,7 +206,7 @@ static struct dentry *ceph_fh_to_parent(struct super_block *sb,
dout("fh_to_parent %llx\n", cfh->parent_ino); dout("fh_to_parent %llx\n", cfh->parent_ino);
dentry = __get_parent(sb, NULL, cfh->ino); dentry = __get_parent(sb, NULL, cfh->ino);
if (IS_ERR(dentry) && PTR_ERR(dentry) == -ENOENT) if (unlikely(dentry == ERR_PTR(-ENOENT)))
dentry = __fh_to_dentry(sb, cfh->parent_ino); dentry = __fh_to_dentry(sb, cfh->parent_ino);
return dentry; return dentry;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment