linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stanislav Kinsbursky <skinsbursky@parallels.com>
To: bfields@fieldses.org, Trond.Myklebust@netapp.com
Cc: linux-nfs@vger.kernel.org, xemul@parallels.com, neilb@suse.de,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	jbottomley@parallels.com, davem@davemloft.net, devel@openvz.org
Subject: [PATCH 4/6] SUNRPC: remove RPC client pipefs dentries after unregister
Date: Wed, 23 Nov 2011 14:51:48 +0300	[thread overview]
Message-ID: <20111123105148.11077.63906.stgit@localhost6.localdomain6> (raw)
In-Reply-To: <20111123104945.11077.10270.stgit@localhost6.localdomain6>

Without this patch we have races:

rpc_fill_super				rpc_free_client
rpc_pipefs_event(MOUNT)			rpc_remove_pipedir
spin_lock(&rpc_client_lock);
rpc_setup_pipedir_sb
spin_unlock(&rpc_client_lock);
					spin_lock(&rpc_client_lock);
					(remove from list)
					spin_unlock(&rpc_client_lock);
					MEAMORY LEAKED

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>

---
 net/sunrpc/clnt.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 61c76ae..23776a4 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -572,7 +572,6 @@ rpc_free_client(struct rpc_clnt *clnt)
 {
 	dprintk("RPC:       destroying %s client for %s\n",
 			clnt->cl_protname, clnt->cl_server);
-	rpc_clnt_remove_pipedir(clnt);
 	if (clnt->cl_parent != clnt) {
 		rpc_release_client(clnt->cl_parent);
 		goto out_free;
@@ -581,6 +580,7 @@ rpc_free_client(struct rpc_clnt *clnt)
 		kfree(clnt->cl_server);
 out_free:
 	rpc_unregister_client(clnt);
+	rpc_clnt_remove_pipedir(clnt);
 	rpc_free_iostats(clnt->cl_metrics);
 	kfree(clnt->cl_principal);
 	clnt->cl_metrics = NULL;


  parent reply	other threads:[~2011-11-23 10:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-23 11:51 [PATCH 0/6] SUNRPC: make RPC clients use network-namespace-aware PipeFS routines Stanislav Kinsbursky
2011-11-23 11:51 ` [PATCH 1/6] SUNRPC: handle RPC client pipefs dentries by network namespace aware routines Stanislav Kinsbursky
2011-11-23 11:51 ` [PATCH 2/6] SUNRPC: handle GSS AUTH pipes " Stanislav Kinsbursky
2011-11-23 11:51 ` [PATCH 3/6] SUNRPC: subscribe RPC clients to pipefs notifications Stanislav Kinsbursky
2011-11-23 11:51 ` Stanislav Kinsbursky [this message]
2011-11-23 11:51 ` [PATCH 5/6] SUNRPC: remove RPC pipefs mount point manipulations from RPC clients code Stanislav Kinsbursky
2011-11-23 11:52 ` [PATCH 6/6] SUNRPC: remove RPC PipeFS mount point reference from RPC client Stanislav Kinsbursky
2011-11-23 16:27 ` [PATCH 0/6] SUNRPC: make RPC clients use network-namespace-aware PipeFS routines J. Bruce Fields
2011-11-23 17:18   ` Stanislav Kinsbursky
2011-11-24  8:45   ` Stanislav Kinsbursky
2011-11-23 16:36 ` J. Bruce Fields
2011-11-23 17:58   ` Stanislav Kinsbursky

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=20111123105148.11077.63906.stgit@localhost6.localdomain6 \
    --to=skinsbursky@parallels.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=bfields@fieldses.org \
    --cc=davem@davemloft.net \
    --cc=devel@openvz.org \
    --cc=jbottomley@parallels.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=netdev@vger.kernel.org \
    --cc=xemul@parallels.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).