From: Jeff Layton <jlayton@kernel.org>
To: ceph-devel@vger.kernel.org
Cc: idryomov@gmail.com, Luis Henriques <lhenriques@suse.de>
Subject: [PATCH] ceph: fix inode leak on getattr error in __fh_to_dentry
Date: Fri, 26 Mar 2021 11:40:32 -0400 [thread overview]
Message-ID: <20210326154032.86410-1-jlayton@kernel.org> (raw)
Cc: Luis Henriques <lhenriques@suse.de>
Fixes: 878dabb64117 (ceph: don't return -ESTALE if there's still an open file)
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/ceph/export.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/ceph/export.c b/fs/ceph/export.c
index f22156ee7306..17d8c8f4ec89 100644
--- a/fs/ceph/export.c
+++ b/fs/ceph/export.c
@@ -178,8 +178,10 @@ static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino)
return ERR_CAST(inode);
/* We need LINK caps to reliably check i_nlink */
err = ceph_do_getattr(inode, CEPH_CAP_LINK_SHARED, false);
- if (err)
+ if (err) {
+ iput(inode);
return ERR_PTR(err);
+ }
/* -ESTALE if inode as been unlinked and no file is open */
if ((inode->i_nlink == 0) && (atomic_read(&inode->i_count) == 1)) {
iput(inode);
--
2.30.2
next reply other threads:[~2021-03-26 15:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-26 15:40 Jeff Layton [this message]
2021-03-29 3:10 ` [PATCH] ceph: fix inode leak on getattr error in __fh_to_dentry Xiubo Li
2021-03-30 13:46 ` Luis Henriques
2021-03-30 16:53 ` Jeff Layton
2021-03-31 9:53 ` Luis Henriques
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210326154032.86410-1-jlayton@kernel.org \
--to=jlayton@kernel.org \
--cc=ceph-devel@vger.kernel.org \
--cc=idryomov@gmail.com \
--cc=lhenriques@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).