mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 22:14:04 +02:00
ceph: fix inode leak on getattr error in __fh_to_dentry
[ Upstream commit1775c7ddac] Fixes:878dabb641("ceph: don't return -ESTALE if there's still an open file") Signed-off-by: Jeff Layton <jlayton@kernel.org> Reviewed-by: Xiubo Li <xiubli@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
a01572e21f
commit
bf45c9fe99
|
|
@ -178,8 +178,10 @@ static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino)
|
||||||
return ERR_CAST(inode);
|
return ERR_CAST(inode);
|
||||||
/* We need LINK caps to reliably check i_nlink */
|
/* We need LINK caps to reliably check i_nlink */
|
||||||
err = ceph_do_getattr(inode, CEPH_CAP_LINK_SHARED, false);
|
err = ceph_do_getattr(inode, CEPH_CAP_LINK_SHARED, false);
|
||||||
if (err)
|
if (err) {
|
||||||
|
iput(inode);
|
||||||
return ERR_PTR(err);
|
return ERR_PTR(err);
|
||||||
|
}
|
||||||
/* -ESTALE if inode as been unlinked and no file is open */
|
/* -ESTALE if inode as been unlinked and no file is open */
|
||||||
if ((inode->i_nlink == 0) && (atomic_read(&inode->i_count) == 1)) {
|
if ((inode->i_nlink == 0) && (atomic_read(&inode->i_count) == 1)) {
|
||||||
iput(inode);
|
iput(inode);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user