diff options
author | Stanislav Kinsbursky <skinsbursky@parallels.com> | 2012-01-12 13:07:51 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-01-31 18:20:25 -0500 |
commit | 70abc49b4f4a4ef04a6bd9852edbd047b480bed7 (patch) | |
tree | 7c9a266ff8838d7945106920a5f0251861a850a5 /net/sunrpc/clnt.c | |
parent | ccdc28f81c91f7ef2dc6c28d27f50264b19e4dd5 (diff) |
SUNRPC: make SUNPRC clients list per network namespace context
This patch moves static SUNRPC clients list and it's lock to sunrpc_net
structure.
Currently this list is used only for debug purposes. But later it will be used
also for selecting clients by networks namespace on PipeFS mount/umount events.
Per-network namespace lists will make this faster and simplier.
Note: client list is taken from "init_net" network namespace context in
rpc_show_tasks(). This will be changed some day later with making SUNRPC
sysctl's per network namespace context.
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/clnt.c')
-rw-r--r-- | net/sunrpc/clnt.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 5ef192c1a57c..90e82c5daeb6 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/sunrpc/bc_xprt.h> | 38 | #include <linux/sunrpc/bc_xprt.h> |
39 | 39 | ||
40 | #include "sunrpc.h" | 40 | #include "sunrpc.h" |
41 | #include "netns.h" | ||
41 | 42 | ||
42 | #ifdef RPC_DEBUG | 43 | #ifdef RPC_DEBUG |
43 | # define RPCDBG_FACILITY RPCDBG_CALL | 44 | # define RPCDBG_FACILITY RPCDBG_CALL |
@@ -50,8 +51,6 @@ | |||
50 | /* | 51 | /* |
51 | * All RPC clients are linked into this list | 52 | * All RPC clients are linked into this list |
52 | */ | 53 | */ |
53 | static LIST_HEAD(all_clients); | ||
54 | static DEFINE_SPINLOCK(rpc_client_lock); | ||
55 | 54 | ||
56 | static DECLARE_WAIT_QUEUE_HEAD(destroy_wait); | 55 | static DECLARE_WAIT_QUEUE_HEAD(destroy_wait); |
57 | 56 | ||
@@ -81,16 +80,20 @@ static int rpc_ping(struct rpc_clnt *clnt); | |||
81 | 80 | ||
82 | static void rpc_register_client(struct rpc_clnt *clnt) | 81 | static void rpc_register_client(struct rpc_clnt *clnt) |
83 | { | 82 | { |
84 | spin_lock(&rpc_client_lock); | 83 | struct sunrpc_net *sn = net_generic(clnt->cl_xprt->xprt_net, sunrpc_net_id); |
85 | list_add(&clnt->cl_clients, &all_clients); | 84 | |
86 | spin_unlock(&rpc_client_lock); | 85 | spin_lock(&sn->rpc_client_lock); |
86 | list_add(&clnt->cl_clients, &sn->all_clients); | ||
87 | spin_unlock(&sn->rpc_client_lock); | ||
87 | } | 88 | } |
88 | 89 | ||
89 | static void rpc_unregister_client(struct rpc_clnt *clnt) | 90 | static void rpc_unregister_client(struct rpc_clnt *clnt) |
90 | { | 91 | { |
91 | spin_lock(&rpc_client_lock); | 92 | struct sunrpc_net *sn = net_generic(clnt->cl_xprt->xprt_net, sunrpc_net_id); |
93 | |||
94 | spin_lock(&sn->rpc_client_lock); | ||
92 | list_del(&clnt->cl_clients); | 95 | list_del(&clnt->cl_clients); |
93 | spin_unlock(&rpc_client_lock); | 96 | spin_unlock(&sn->rpc_client_lock); |
94 | } | 97 | } |
95 | 98 | ||
96 | static void __rpc_clnt_remove_pipedir(struct rpc_clnt *clnt) | 99 | static void __rpc_clnt_remove_pipedir(struct rpc_clnt *clnt) |
@@ -1883,14 +1886,15 @@ static void rpc_show_task(const struct rpc_clnt *clnt, | |||
1883 | task->tk_action, rpc_waitq); | 1886 | task->tk_action, rpc_waitq); |
1884 | } | 1887 | } |
1885 | 1888 | ||
1886 | void rpc_show_tasks(void) | 1889 | void rpc_show_tasks(struct net *net) |
1887 | { | 1890 | { |
1888 | struct rpc_clnt *clnt; | 1891 | struct rpc_clnt *clnt; |
1889 | struct rpc_task *task; | 1892 | struct rpc_task *task; |
1890 | int header = 0; | 1893 | int header = 0; |
1894 | struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); | ||
1891 | 1895 | ||
1892 | spin_lock(&rpc_client_lock); | 1896 | spin_lock(&sn->rpc_client_lock); |
1893 | list_for_each_entry(clnt, &all_clients, cl_clients) { | 1897 | list_for_each_entry(clnt, &sn->all_clients, cl_clients) { |
1894 | spin_lock(&clnt->cl_lock); | 1898 | spin_lock(&clnt->cl_lock); |
1895 | list_for_each_entry(task, &clnt->cl_tasks, tk_task) { | 1899 | list_for_each_entry(task, &clnt->cl_tasks, tk_task) { |
1896 | if (!header) { | 1900 | if (!header) { |
@@ -1901,6 +1905,6 @@ void rpc_show_tasks(void) | |||
1901 | } | 1905 | } |
1902 | spin_unlock(&clnt->cl_lock); | 1906 | spin_unlock(&clnt->cl_lock); |
1903 | } | 1907 | } |
1904 | spin_unlock(&rpc_client_lock); | 1908 | spin_unlock(&sn->rpc_client_lock); |
1905 | } | 1909 | } |
1906 | #endif | 1910 | #endif |