From: Jeff Layton <jlayton@primarydata.com>
To: bfields@fieldses.org
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH] nfsd: fix file access refcount leak when nfsd4_truncate fails
Date: Thu, 26 Jun 2014 06:49:16 -0400 [thread overview]
Message-ID: <1403779756-5070-1-git-send-email-jlayton@primarydata.com> (raw)
We currently will get access to the file, and then call nfsd4_truncate
to (possibly) truncate it. If that operation fails though, then the
access references will never be released as the nfs4_ol_stateid is
never initialized.
Signed-off-by: Jeff Layton <jlayton@primarydata.com>
---
fs/nfsd/nfs4state.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 2204e1fe5725..3b19008c2978 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -3351,8 +3351,11 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
if (status)
goto out;
status = nfsd4_truncate(rqstp, current_fh, open);
- if (status)
+ if (status) {
+ nfs4_file_put_access(fp,
+ nfs4_access_to_omode(open->op_share_access));
goto out;
+ }
stp = open->op_stp;
open->op_stp = NULL;
init_open_stateid(stp, fp, open);
--
1.9.3
next reply other threads:[~2014-06-26 10:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-26 10:49 Jeff Layton [this message]
2014-06-26 11:17 ` [PATCH] nfsd: fix file access refcount leak when nfsd4_truncate fails Christoph Hellwig
2014-06-26 13:33 ` Jeff Layton
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=1403779756-5070-1-git-send-email-jlayton@primarydata.com \
--to=jlayton@primarydata.com \
--cc=bfields@fieldses.org \
--cc=linux-nfs@vger.kernel.org \
/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