All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] SUNRPC: skip dead but not buried clients on PipeFS events
@ 2012-04-19 10:57 Stanislav Kinsbursky
  2012-04-19 11:36   ` Stanislav Kinsbursky
  0 siblings, 1 reply; 6+ messages in thread
From: Stanislav Kinsbursky @ 2012-04-19 10:57 UTC (permalink / raw)
  To: Trond.Myklebust
  Cc: linux-nfs, xemul, neilb, netdev, linux-kernel, jbottomley,
	bfields, davem, devel

These clients can't be safely dereferenced if their counter in 0.

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

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

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

diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 6797246..591994d 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -218,7 +218,8 @@ static struct rpc_clnt *rpc_get_client_for_event(struct net *net, int event)
 		if (((event == RPC_PIPEFS_MOUNT) && clnt->cl_dentry) ||
 		    ((event == RPC_PIPEFS_UMOUNT) && !clnt->cl_dentry))
 			continue;
-		atomic_inc(&clnt->cl_count);
+		if (atomic_inc_return(&clnt->cl_count) == 1)
+			continue;
 		spin_unlock(&sn->rpc_client_lock);
 		return clnt;
 	}


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

end of thread, other threads:[~2012-04-20  6:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-19 10:57 [PATCH] SUNRPC: skip dead but not buried clients on PipeFS events Stanislav Kinsbursky
2012-04-19 11:36 ` Stanislav Kinsbursky
2012-04-19 11:36   ` Stanislav Kinsbursky
2012-04-19 21:40   ` bfields
2012-04-20  6:05     ` Stanislav Kinsbursky
2012-04-20  6:05       ` Stanislav Kinsbursky

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.