All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nfsd: fix file access refcount leak when nfsd4_truncate fails
@ 2014-06-26 10:49 Jeff Layton
  2014-06-26 11:17 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Layton @ 2014-06-26 10:49 UTC (permalink / raw)
  To: bfields; +Cc: linux-nfs

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-06-26 13:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-26 10:49 [PATCH] nfsd: fix file access refcount leak when nfsd4_truncate fails Jeff Layton
2014-06-26 11:17 ` Christoph Hellwig
2014-06-26 13:33   ` Jeff Layton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.