aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/clnt.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2006-11-16 11:37:27 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-12-06 10:46:29 -0500
commit3e32a5d99a467b9d4d416323c8c292479b4915e5 (patch)
tree96cf078675e55c19676b2c28432c609d60ea2ac1 /net/sunrpc/clnt.c
parent23bf85ba43650e4341672a6bc85aa3f2c02eb633 (diff)
SUNRPC: Give cloned RPC clients their own rpc_pipefs directory
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/clnt.c')
-rw-r--r--net/sunrpc/clnt.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index de8bbfcd5030..8b78177e7575 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -144,6 +144,7 @@ static struct rpc_clnt * rpc_new_client(struct rpc_xprt *xprt, char *servname, s
144 err = -ENOMEM; 144 err = -ENOMEM;
145 if (clnt->cl_metrics == NULL) 145 if (clnt->cl_metrics == NULL)
146 goto out_no_stats; 146 goto out_no_stats;
147 clnt->cl_program = program;
147 148
148 if (!xprt_bound(clnt->cl_xprt)) 149 if (!xprt_bound(clnt->cl_xprt))
149 clnt->cl_autobind = 1; 150 clnt->cl_autobind = 1;
@@ -257,6 +258,7 @@ struct rpc_clnt *
257rpc_clone_client(struct rpc_clnt *clnt) 258rpc_clone_client(struct rpc_clnt *clnt)
258{ 259{
259 struct rpc_clnt *new; 260 struct rpc_clnt *new;
261 int err = -ENOMEM;
260 262
261 new = kmemdup(clnt, sizeof(*new), GFP_KERNEL); 263 new = kmemdup(clnt, sizeof(*new), GFP_KERNEL);
262 if (!new) 264 if (!new)
@@ -266,6 +268,9 @@ rpc_clone_client(struct rpc_clnt *clnt)
266 new->cl_metrics = rpc_alloc_iostats(clnt); 268 new->cl_metrics = rpc_alloc_iostats(clnt);
267 if (new->cl_metrics == NULL) 269 if (new->cl_metrics == NULL)
268 goto out_no_stats; 270 goto out_no_stats;
271 err = rpc_setup_pipedir(new, clnt->cl_program->pipe_dir_name);
272 if (err != 0)
273 goto out_no_path;
269 new->cl_parent = clnt; 274 new->cl_parent = clnt;
270 atomic_inc(&clnt->cl_count); 275 atomic_inc(&clnt->cl_count);
271 new->cl_xprt = xprt_get(clnt->cl_xprt); 276 new->cl_xprt = xprt_get(clnt->cl_xprt);
@@ -273,17 +278,17 @@ rpc_clone_client(struct rpc_clnt *clnt)
273 new->cl_autobind = 0; 278 new->cl_autobind = 0;
274 new->cl_oneshot = 0; 279 new->cl_oneshot = 0;
275 new->cl_dead = 0; 280 new->cl_dead = 0;
276 if (!IS_ERR(new->cl_dentry))
277 dget(new->cl_dentry);
278 rpc_init_rtt(&new->cl_rtt_default, clnt->cl_xprt->timeout.to_initval); 281 rpc_init_rtt(&new->cl_rtt_default, clnt->cl_xprt->timeout.to_initval);
279 if (new->cl_auth) 282 if (new->cl_auth)
280 atomic_inc(&new->cl_auth->au_count); 283 atomic_inc(&new->cl_auth->au_count);
281 return new; 284 return new;
285out_no_path:
286 rpc_free_iostats(new->cl_metrics);
282out_no_stats: 287out_no_stats:
283 kfree(new); 288 kfree(new);
284out_no_clnt: 289out_no_clnt:
285 printk(KERN_INFO "RPC: out of memory in %s\n", __FUNCTION__); 290 dprintk("RPC: %s returned error %d\n", __FUNCTION__, err);
286 return ERR_PTR(-ENOMEM); 291 return ERR_PTR(err);
287} 292}
288 293
289/* 294/*
@@ -336,16 +341,14 @@ rpc_destroy_client(struct rpc_clnt *clnt)
336 rpcauth_destroy(clnt->cl_auth); 341 rpcauth_destroy(clnt->cl_auth);
337 clnt->cl_auth = NULL; 342 clnt->cl_auth = NULL;
338 } 343 }
339 if (clnt->cl_parent != clnt) {
340 if (!IS_ERR(clnt->cl_dentry))
341 dput(clnt->cl_dentry);
342 rpc_destroy_client(clnt->cl_parent);
343 goto out_free;
344 }
345 if (!IS_ERR(clnt->cl_dentry)) { 344 if (!IS_ERR(clnt->cl_dentry)) {
346 rpc_rmdir(clnt->cl_dentry); 345 rpc_rmdir(clnt->cl_dentry);
347 rpc_put_mount(); 346 rpc_put_mount();
348 } 347 }
348 if (clnt->cl_parent != clnt) {
349 rpc_destroy_client(clnt->cl_parent);
350 goto out_free;
351 }
349 if (clnt->cl_server != clnt->cl_inline_name) 352 if (clnt->cl_server != clnt->cl_inline_name)
350 kfree(clnt->cl_server); 353 kfree(clnt->cl_server);
351out_free: 354out_free: