linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: ycnian@gmail.com
To: bfields@fieldses.org
Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	Yanchuan Nian <ycnian@gmail.com>
Subject: [PATCH v2] nfsd: fix bug on nfs4 stateid deallocation
Date: Mon, 11 Mar 2013 08:46:14 +0800	[thread overview]
Message-ID: <1362962774-5141-1-git-send-email-ycnian@gmail.com> (raw)

NFS4_OO_PURGE_CLOSE is not handled properly. To avoid memory leak, nfs4 
stateid which is pointed by oo_last_closed_stid is freed in nfsd4_close(), 
but NFS4_OO_PURGE_CLOSE isn't cleared meanwhile. So the stateid released in 
THIS close procedure may be freed immediately in the coming encoding function.
Sorry that Signed-off-by was forgotten in last version.

Signed-off-by: Yanchuan Nian <ycnian@gmail.com>
---
 fs/nfsd/nfs4state.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index cc41bf4..d972db8 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -3827,6 +3827,7 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 
 	nfsd4_close_open_stateid(stp);
 	release_last_closed_stateid(oo);
+	oo->oo_flags &= ~NFS4_OO_PURGE_CLOSE;
 	oo->oo_last_closed_stid = stp;
 
 	if (list_empty(&oo->oo_owner.so_stateids)) {
-- 
1.7.4.4


             reply	other threads:[~2013-03-11  0:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-11  0:46 ycnian [this message]
2013-03-11 15:02 ` [PATCH v2] nfsd: fix bug on nfs4 stateid deallocation J. Bruce Fields
     [not found]   ` <CAC5OsZPyuOj_3OUJZFu1Haqg=q6GCyyqDL=n+Y5Wr48D1-SkSg@mail.gmail.com>
2013-04-02  1:50     ` J. Bruce Fields
2013-04-03 10:58       ` Yanchuan Nian
2013-04-03 18:55         ` J. Bruce Fields
2013-04-04 14:04           ` Yanchuan Nian
2013-04-05 14:20             ` J. Bruce Fields
2013-04-08 13:54               ` Yanchuan Nian
2013-04-08 13:56                 ` J. Bruce Fields

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=1362962774-5141-1-git-send-email-ycnian@gmail.com \
    --to=ycnian@gmail.com \
    --cc=bfields@fieldses.org \
    --cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).