linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dai Ngo <dai.ngo@oracle.com>
To: olga.kornievskaia@gmail.com
Cc: trondmy@hammerspace.com, linux-nfs@vger.kernel.org
Subject: [PATCH] NFSv4.2: destination file needs to be released after inter-server copy is done.
Date: Tue,  2 Mar 2021 14:46:59 -0500	[thread overview]
Message-ID: <20210302194659.98563-1-dai.ngo@oracle.com> (raw)

This patch is to fix the resource leak problem of the source file
when doing inter-server copy. The fix is to close and release the
file in __nfs42_ssc_close after the copy is done.

Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
---
 fs/nfs/nfs4file.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c
index 57b3821d975a..20163fe702a7 100644
--- a/fs/nfs/nfs4file.c
+++ b/fs/nfs/nfs4file.c
@@ -405,6 +405,12 @@ static void __nfs42_ssc_close(struct file *filep)
 	struct nfs_open_context *ctx = nfs_file_open_context(filep);
 
 	ctx->state->flags = 0;
+
+	if (!filep)
+		return;
+	get_file(filep);
+	filp_close(filep, NULL);
+	fput(filep);
 }
 
 static const struct nfs4_ssc_client_ops nfs4_ssc_clnt_ops_tbl = {
-- 
2.9.5


             reply	other threads:[~2021-03-03 11:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-02 19:46 Dai Ngo [this message]
2021-03-08 18:35 ` [PATCH] NFSv4.2: destination file needs to be released after inter-server copy is done Olga Kornievskaia
2021-03-08 20:10   ` dai.ngo
2021-03-09 13:57     ` Olga Kornievskaia

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=20210302194659.98563-1-dai.ngo@oracle.com \
    --to=dai.ngo@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=olga.kornievskaia@gmail.com \
    --cc=trondmy@hammerspace.com \
    /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).