Skip to content

Commit

Permalink
SUNRPC: use rpcbind reference counting helpers
Browse files Browse the repository at this point in the history
All is simple: we just increase users counter if rpcbind clients has been
created already. Otherwise we create them and set users counter to 1.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
  • Loading branch information
Stanislav Kinsbursky authored and Trond Myklebust committed Oct 25, 2011
1 parent 914edb1 commit 253fb07
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions net/sunrpc/rpcb_clnt.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,7 @@ static int rpcb_create_local_unix(void)
clnt4 = NULL;
}

/* Protected by rpcb_create_local_mutex */
rpcb_local_clnt = clnt;
rpcb_local_clnt4 = clnt4;
rpcb_set_local(clnt, clnt4);

out:
return result;
Expand Down Expand Up @@ -312,9 +310,7 @@ static int rpcb_create_local_net(void)
clnt4 = NULL;
}

/* Protected by rpcb_create_local_mutex */
rpcb_local_clnt = clnt;
rpcb_local_clnt4 = clnt4;
rpcb_set_local(clnt, clnt4);

out:
return result;
Expand All @@ -329,11 +325,11 @@ static int rpcb_create_local(void)
static DEFINE_MUTEX(rpcb_create_local_mutex);
int result = 0;

if (rpcb_local_clnt)
if (rpcb_get_local())
return result;

mutex_lock(&rpcb_create_local_mutex);
if (rpcb_local_clnt)
if (rpcb_get_local())
goto out;

if (rpcb_create_local_unix() != 0)
Expand Down

0 comments on commit 253fb07

Please sign in to comment.