All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pnfsd: Update the reference of nfs4_layout_state properly
@ 2013-01-15  2:37 ycnian
  2013-01-21 14:47 ` Benny Halevy
  0 siblings, 1 reply; 2+ messages in thread
From: ycnian @ 2013-01-15  2:37 UTC (permalink / raw)
  To: bhalevy; +Cc: linux-nfs, Yanchuan Nian

From: Yanchuan Nian <ycnian@gmail.com>

The reference of nfs4_layout_state is set to 1 when creating.
it isn't necessary to increase the reference again in
nfs4_process_layout_stateid(), otherwise it will lead to a
memory leak.

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

diff --git a/fs/nfsd/nfs4pnfsd.c b/fs/nfsd/nfs4pnfsd.c
index 2211b50..dd7856c 100644
--- a/fs/nfsd/nfs4pnfsd.c
+++ b/fs/nfsd/nfs4pnfsd.c
@@ -248,10 +248,10 @@ nfs4_process_layout_stateid(struct nfs4_client *clp, struct nfs4_file *fp,
 			status = nfserr_bad_stateid;
 			goto out;
 		}
+		get_layout_state(ls);
 	}
 	status = 0;
 
-	get_layout_state(ls);
 	*lsp = ls;
 	dprintk("%s: layout stateid=" STATEID_FMT " ref=%d\n", __func__,
 		STATEID_VAL(&ls->ls_stid.sc_stateid), atomic_read(&ls->ls_ref.refcount));
-- 
1.7.4.4


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

end of thread, other threads:[~2013-01-21 14:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-15  2:37 [PATCH] pnfsd: Update the reference of nfs4_layout_state properly ycnian
2013-01-21 14:47 ` Benny Halevy

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.