diff options
Diffstat (limited to 'net/sunrpc/clnt.c')
-rw-r--r-- | net/sunrpc/clnt.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index a323abc7ea85..de8bbfcd5030 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -141,6 +141,9 @@ static struct rpc_clnt * rpc_new_client(struct rpc_xprt *xprt, char *servname, s | |||
141 | clnt->cl_vers = version->number; | 141 | clnt->cl_vers = version->number; |
142 | clnt->cl_stats = program->stats; | 142 | clnt->cl_stats = program->stats; |
143 | clnt->cl_metrics = rpc_alloc_iostats(clnt); | 143 | clnt->cl_metrics = rpc_alloc_iostats(clnt); |
144 | err = -ENOMEM; | ||
145 | if (clnt->cl_metrics == NULL) | ||
146 | goto out_no_stats; | ||
144 | 147 | ||
145 | if (!xprt_bound(clnt->cl_xprt)) | 148 | if (!xprt_bound(clnt->cl_xprt)) |
146 | clnt->cl_autobind = 1; | 149 | clnt->cl_autobind = 1; |
@@ -173,6 +176,8 @@ out_no_auth: | |||
173 | rpc_put_mount(); | 176 | rpc_put_mount(); |
174 | } | 177 | } |
175 | out_no_path: | 178 | out_no_path: |
179 | rpc_free_iostats(clnt->cl_metrics); | ||
180 | out_no_stats: | ||
176 | if (clnt->cl_server != clnt->cl_inline_name) | 181 | if (clnt->cl_server != clnt->cl_inline_name) |
177 | kfree(clnt->cl_server); | 182 | kfree(clnt->cl_server); |
178 | kfree(clnt); | 183 | kfree(clnt); |
@@ -258,6 +263,9 @@ rpc_clone_client(struct rpc_clnt *clnt) | |||
258 | goto out_no_clnt; | 263 | goto out_no_clnt; |
259 | atomic_set(&new->cl_count, 1); | 264 | atomic_set(&new->cl_count, 1); |
260 | atomic_set(&new->cl_users, 0); | 265 | atomic_set(&new->cl_users, 0); |
266 | new->cl_metrics = rpc_alloc_iostats(clnt); | ||
267 | if (new->cl_metrics == NULL) | ||
268 | goto out_no_stats; | ||
261 | new->cl_parent = clnt; | 269 | new->cl_parent = clnt; |
262 | atomic_inc(&clnt->cl_count); | 270 | atomic_inc(&clnt->cl_count); |
263 | new->cl_xprt = xprt_get(clnt->cl_xprt); | 271 | new->cl_xprt = xprt_get(clnt->cl_xprt); |
@@ -270,8 +278,9 @@ rpc_clone_client(struct rpc_clnt *clnt) | |||
270 | rpc_init_rtt(&new->cl_rtt_default, clnt->cl_xprt->timeout.to_initval); | 278 | rpc_init_rtt(&new->cl_rtt_default, clnt->cl_xprt->timeout.to_initval); |
271 | if (new->cl_auth) | 279 | if (new->cl_auth) |
272 | atomic_inc(&new->cl_auth->au_count); | 280 | atomic_inc(&new->cl_auth->au_count); |
273 | new->cl_metrics = rpc_alloc_iostats(clnt); | ||
274 | return new; | 281 | return new; |
282 | out_no_stats: | ||
283 | kfree(new); | ||
275 | out_no_clnt: | 284 | out_no_clnt: |
276 | printk(KERN_INFO "RPC: out of memory in %s\n", __FUNCTION__); | 285 | printk(KERN_INFO "RPC: out of memory in %s\n", __FUNCTION__); |
277 | return ERR_PTR(-ENOMEM); | 286 | return ERR_PTR(-ENOMEM); |