aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/clnt.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2006-09-05 12:55:57 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-09-22 23:25:01 -0400
commit6b6ca86b77b62b798cf9ca2599036420abce7796 (patch)
treecf631a3c293be45fa4bed54bca5dcbfc96a57df1 /net/sunrpc/clnt.c
parentda45828e2835057045150b318c4fbe9bb91f18dd (diff)
SUNRPC: Add refcounting to the struct rpc_xprt
In a subsequent patch, this will allow the portmapper to take a reference to the rpc_xprt for which it is updating the port number, fixing an Oops. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/clnt.c')
-rw-r--r--net/sunrpc/clnt.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index ceadb728f0da..084a0ad5c64e 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -177,7 +177,7 @@ out_no_path:
177 kfree(clnt->cl_server); 177 kfree(clnt->cl_server);
178 kfree(clnt); 178 kfree(clnt);
179out_err: 179out_err:
180 xprt_destroy(xprt); 180 xprt_put(xprt);
181out_no_xprt: 181out_no_xprt:
182 return ERR_PTR(err); 182 return ERR_PTR(err);
183} 183}
@@ -261,6 +261,7 @@ rpc_clone_client(struct rpc_clnt *clnt)
261 atomic_set(&new->cl_users, 0); 261 atomic_set(&new->cl_users, 0);
262 new->cl_parent = clnt; 262 new->cl_parent = clnt;
263 atomic_inc(&clnt->cl_count); 263 atomic_inc(&clnt->cl_count);
264 new->cl_xprt = xprt_get(clnt->cl_xprt);
264 /* Turn off autobind on clones */ 265 /* Turn off autobind on clones */
265 new->cl_autobind = 0; 266 new->cl_autobind = 0;
266 new->cl_oneshot = 0; 267 new->cl_oneshot = 0;
@@ -337,15 +338,12 @@ rpc_destroy_client(struct rpc_clnt *clnt)
337 rpc_rmdir(clnt->cl_dentry); 338 rpc_rmdir(clnt->cl_dentry);
338 rpc_put_mount(); 339 rpc_put_mount();
339 } 340 }
340 if (clnt->cl_xprt) {
341 xprt_destroy(clnt->cl_xprt);
342 clnt->cl_xprt = NULL;
343 }
344 if (clnt->cl_server != clnt->cl_inline_name) 341 if (clnt->cl_server != clnt->cl_inline_name)
345 kfree(clnt->cl_server); 342 kfree(clnt->cl_server);
346out_free: 343out_free:
347 rpc_free_iostats(clnt->cl_metrics); 344 rpc_free_iostats(clnt->cl_metrics);
348 clnt->cl_metrics = NULL; 345 clnt->cl_metrics = NULL;
346 xprt_put(clnt->cl_xprt);
349 kfree(clnt); 347 kfree(clnt);
350 return 0; 348 return 0;
351} 349}