been in mainline since 2.6.20-rc1.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
+[chrisw: backport to 2.6.19.2]
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
---
-
include/linux/sunrpc/clnt.h | 1 +
- net/sunrpc/clnt.c | 23 +++++++++++++----------
- 2 files changed, 14 insertions(+), 10 deletions(-)
+ net/sunrpc/clnt.c | 26 +++++++++++++++-----------
+ 2 files changed, 16 insertions(+), 11 deletions(-)
-diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
-index f6d1d64..a1be89d 100644
---- a/include/linux/sunrpc/clnt.h
-+++ b/include/linux/sunrpc/clnt.h
+--- linux-2.6.19.2.orig/include/linux/sunrpc/clnt.h
++++ linux-2.6.19.2/include/linux/sunrpc/clnt.h
@@ -53,6 +53,7 @@ struct rpc_clnt {
struct dentry * cl_dentry; /* inode */
struct rpc_clnt * cl_parent; /* Points to parent of clones */
char cl_inline_name[32];
};
-diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
-index de8bbfc..8b78177 100644
---- a/net/sunrpc/clnt.c
-+++ b/net/sunrpc/clnt.c
-@@ -144,6 +144,7 @@ static struct rpc_clnt * rpc_new_client(
- err = -ENOMEM;
- if (clnt->cl_metrics == NULL)
- goto out_no_stats;
+--- linux-2.6.19.2.orig/net/sunrpc/clnt.c
++++ linux-2.6.19.2/net/sunrpc/clnt.c
+@@ -141,6 +141,7 @@ static struct rpc_clnt * rpc_new_client(
+ clnt->cl_vers = version->number;
+ clnt->cl_stats = program->stats;
+ clnt->cl_metrics = rpc_alloc_iostats(clnt);
+ clnt->cl_program = program;
if (!xprt_bound(clnt->cl_xprt))
clnt->cl_autobind = 1;
-@@ -257,6 +258,7 @@ struct rpc_clnt *
+@@ -252,6 +253,7 @@ struct rpc_clnt *
rpc_clone_client(struct rpc_clnt *clnt)
{
struct rpc_clnt *new;
+ int err = -ENOMEM;
- new = kmemdup(clnt, sizeof(*new), GFP_KERNEL);
+ new = kmalloc(sizeof(*new), GFP_KERNEL);
if (!new)
-@@ -266,6 +268,9 @@ rpc_clone_client(struct rpc_clnt *clnt)
- new->cl_metrics = rpc_alloc_iostats(clnt);
- if (new->cl_metrics == NULL)
- goto out_no_stats;
+@@ -259,6 +261,10 @@ rpc_clone_client(struct rpc_clnt *clnt)
+ memcpy(new, clnt, sizeof(*new));
+ atomic_set(&new->cl_count, 1);
+ atomic_set(&new->cl_users, 0);
++ new->cl_metrics = rpc_alloc_iostats(clnt);
+ err = rpc_setup_pipedir(new, clnt->cl_program->pipe_dir_name);
+ if (err != 0)
+ goto out_no_path;
new->cl_parent = clnt;
atomic_inc(&clnt->cl_count);
new->cl_xprt = xprt_get(clnt->cl_xprt);
-@@ -273,17 +278,17 @@ rpc_clone_client(struct rpc_clnt *clnt)
+@@ -266,16 +272,16 @@ rpc_clone_client(struct rpc_clnt *clnt)
new->cl_autobind = 0;
new->cl_oneshot = 0;
new->cl_dead = 0;
rpc_init_rtt(&new->cl_rtt_default, clnt->cl_xprt->timeout.to_initval);
if (new->cl_auth)
atomic_inc(&new->cl_auth->au_count);
+- new->cl_metrics = rpc_alloc_iostats(clnt);
return new;
+out_no_path:
+ rpc_free_iostats(new->cl_metrics);
- out_no_stats:
- kfree(new);
++ kfree(new);
out_no_clnt:
- printk(KERN_INFO "RPC: out of memory in %s\n", __FUNCTION__);
- return ERR_PTR(-ENOMEM);
}
/*
-@@ -336,16 +341,14 @@ rpc_destroy_client(struct rpc_clnt *clnt
+@@ -328,16 +334,14 @@ rpc_destroy_client(struct rpc_clnt *clnt
rpcauth_destroy(clnt->cl_auth);
clnt->cl_auth = NULL;
}