aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/clnt.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2006-03-20 13:44:49 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-03-20 13:44:49 -0500
commit5428154827c2bf7cfdc9dab60db1e0eaa57c027a (patch)
treeec2e6c9119ad76cad353a50da2be3ac71adbf54d /net/sunrpc/clnt.c
parenta9a801787a761616589a6526d7a29c13f4deb3d8 (diff)
SUNRPC: Fix a 'Busy inodes' error in rpc_pipefs
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/clnt.c')
-rw-r--r--net/sunrpc/clnt.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 0bb23e8e9d0c..9f775302d1df 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -70,8 +70,15 @@ rpc_setup_pipedir(struct rpc_clnt *clnt, char *dir_name)
70 static uint32_t clntid; 70 static uint32_t clntid;
71 int error; 71 int error;
72 72
73 clnt->cl_vfsmnt = ERR_PTR(-ENOENT);
74 clnt->cl_dentry = ERR_PTR(-ENOENT);
73 if (dir_name == NULL) 75 if (dir_name == NULL)
74 return 0; 76 return 0;
77
78 clnt->cl_vfsmnt = rpc_get_mount();
79 if (IS_ERR(clnt->cl_vfsmnt))
80 return PTR_ERR(clnt->cl_vfsmnt);
81
75 for (;;) { 82 for (;;) {
76 snprintf(clnt->cl_pathname, sizeof(clnt->cl_pathname), 83 snprintf(clnt->cl_pathname, sizeof(clnt->cl_pathname),
77 "%s/clnt%x", dir_name, 84 "%s/clnt%x", dir_name,
@@ -84,6 +91,7 @@ rpc_setup_pipedir(struct rpc_clnt *clnt, char *dir_name)
84 if (error != -EEXIST) { 91 if (error != -EEXIST) {
85 printk(KERN_INFO "RPC: Couldn't create pipefs entry %s, error %d\n", 92 printk(KERN_INFO "RPC: Couldn't create pipefs entry %s, error %d\n",
86 clnt->cl_pathname, error); 93 clnt->cl_pathname, error);
94 rpc_put_mount();
87 return error; 95 return error;
88 } 96 }
89 } 97 }
@@ -175,7 +183,11 @@ rpc_new_client(struct rpc_xprt *xprt, char *servname,
175 return clnt; 183 return clnt;
176 184
177out_no_auth: 185out_no_auth:
178 rpc_rmdir(clnt->cl_pathname); 186 if (!IS_ERR(clnt->cl_dentry)) {
187 rpc_rmdir(clnt->cl_pathname);
188 dput(clnt->cl_dentry);
189 rpc_put_mount();
190 }
179out_no_path: 191out_no_path:
180 if (clnt->cl_server != clnt->cl_inline_name) 192 if (clnt->cl_server != clnt->cl_inline_name)
181 kfree(clnt->cl_server); 193 kfree(clnt->cl_server);
@@ -240,13 +252,15 @@ rpc_clone_client(struct rpc_clnt *clnt)
240 new->cl_autobind = 0; 252 new->cl_autobind = 0;
241 new->cl_oneshot = 0; 253 new->cl_oneshot = 0;
242 new->cl_dead = 0; 254 new->cl_dead = 0;
243 dget(new->cl_dentry); 255 if (!IS_ERR(new->cl_dentry)) {
256 dget(new->cl_dentry);
257 rpc_get_mount();
258 }
244 rpc_init_rtt(&new->cl_rtt_default, clnt->cl_xprt->timeout.to_initval); 259 rpc_init_rtt(&new->cl_rtt_default, clnt->cl_xprt->timeout.to_initval);
245 if (new->cl_auth) 260 if (new->cl_auth)
246 atomic_inc(&new->cl_auth->au_count); 261 atomic_inc(&new->cl_auth->au_count);
247 new->cl_pmap = &new->cl_pmap_default; 262 new->cl_pmap = &new->cl_pmap_default;
248 new->cl_metrics = rpc_alloc_iostats(clnt); 263 new->cl_metrics = rpc_alloc_iostats(clnt);
249 rpc_init_wait_queue(&new->cl_pmap_default.pm_bindwait, "bindwait");
250 return new; 264 return new;
251out_no_clnt: 265out_no_clnt:
252 printk(KERN_INFO "RPC: out of memory in %s\n", __FUNCTION__); 266 printk(KERN_INFO "RPC: out of memory in %s\n", __FUNCTION__);
@@ -318,8 +332,10 @@ rpc_destroy_client(struct rpc_clnt *clnt)
318out_free: 332out_free:
319 rpc_free_iostats(clnt->cl_metrics); 333 rpc_free_iostats(clnt->cl_metrics);
320 clnt->cl_metrics = NULL; 334 clnt->cl_metrics = NULL;
321 if (clnt->cl_dentry) 335 if (!IS_ERR(clnt->cl_dentry)) {
322 dput(clnt->cl_dentry); 336 dput(clnt->cl_dentry);
337 rpc_put_mount();
338 }
323 kfree(clnt); 339 kfree(clnt);
324 return 0; 340 return 0;
325} 341}