Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 294373
b: refs/heads/master
c: 70abc49
h: refs/heads/master
i:
  294371: 1de5cc4
v: v3
  • Loading branch information
Stanislav Kinsbursky authored and Trond Myklebust committed Jan 31, 2012
1 parent 9d7b582 commit 264e94e
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ccdc28f81c91f7ef2dc6c28d27f50264b19e4dd5
refs/heads/master: 70abc49b4f4a4ef04a6bd9852edbd047b480bed7
3 changes: 2 additions & 1 deletion trunk/include/linux/sunrpc/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,8 @@ int rpciod_up(void);
void rpciod_down(void);
int __rpc_wait_for_completion_task(struct rpc_task *task, int (*)(void *));
#ifdef RPC_DEBUG
void rpc_show_tasks(void);
struct net;
void rpc_show_tasks(struct net *);
#endif
int rpc_init_mempool(void);
void rpc_destroy_mempool(void);
Expand Down
26 changes: 15 additions & 11 deletions trunk/net/sunrpc/clnt.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <linux/sunrpc/bc_xprt.h>

#include "sunrpc.h"
#include "netns.h"

#ifdef RPC_DEBUG
# define RPCDBG_FACILITY RPCDBG_CALL
Expand All @@ -50,8 +51,6 @@
/*
* All RPC clients are linked into this list
*/
static LIST_HEAD(all_clients);
static DEFINE_SPINLOCK(rpc_client_lock);

static DECLARE_WAIT_QUEUE_HEAD(destroy_wait);

Expand Down Expand Up @@ -81,16 +80,20 @@ static int rpc_ping(struct rpc_clnt *clnt);

static void rpc_register_client(struct rpc_clnt *clnt)
{
spin_lock(&rpc_client_lock);
list_add(&clnt->cl_clients, &all_clients);
spin_unlock(&rpc_client_lock);
struct sunrpc_net *sn = net_generic(clnt->cl_xprt->xprt_net, sunrpc_net_id);

spin_lock(&sn->rpc_client_lock);
list_add(&clnt->cl_clients, &sn->all_clients);
spin_unlock(&sn->rpc_client_lock);
}

static void rpc_unregister_client(struct rpc_clnt *clnt)
{
spin_lock(&rpc_client_lock);
struct sunrpc_net *sn = net_generic(clnt->cl_xprt->xprt_net, sunrpc_net_id);

spin_lock(&sn->rpc_client_lock);
list_del(&clnt->cl_clients);
spin_unlock(&rpc_client_lock);
spin_unlock(&sn->rpc_client_lock);
}

static void __rpc_clnt_remove_pipedir(struct rpc_clnt *clnt)
Expand Down Expand Up @@ -1883,14 +1886,15 @@ static void rpc_show_task(const struct rpc_clnt *clnt,
task->tk_action, rpc_waitq);
}

void rpc_show_tasks(void)
void rpc_show_tasks(struct net *net)
{
struct rpc_clnt *clnt;
struct rpc_task *task;
int header = 0;
struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);

spin_lock(&rpc_client_lock);
list_for_each_entry(clnt, &all_clients, cl_clients) {
spin_lock(&sn->rpc_client_lock);
list_for_each_entry(clnt, &sn->all_clients, cl_clients) {
spin_lock(&clnt->cl_lock);
list_for_each_entry(task, &clnt->cl_tasks, tk_task) {
if (!header) {
Expand All @@ -1901,6 +1905,6 @@ void rpc_show_tasks(void)
}
spin_unlock(&clnt->cl_lock);
}
spin_unlock(&rpc_client_lock);
spin_unlock(&sn->rpc_client_lock);
}
#endif
3 changes: 3 additions & 0 deletions trunk/net/sunrpc/netns.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ struct sunrpc_net {

struct super_block *pipefs_sb;
struct mutex pipefs_sb_lock;

struct list_head all_clients;
spinlock_t rpc_client_lock;
};

extern int sunrpc_net_id;
Expand Down
3 changes: 3 additions & 0 deletions trunk/net/sunrpc/sunrpc_syms.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ int sunrpc_net_id;
static __net_init int sunrpc_init_net(struct net *net)
{
int err;
struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);

err = rpc_proc_init(net);
if (err)
Expand All @@ -39,6 +40,8 @@ static __net_init int sunrpc_init_net(struct net *net)
goto err_ipmap;

rpc_pipefs_init_net(net);
INIT_LIST_HEAD(&sn->all_clients);
spin_lock_init(&sn->rpc_client_lock);
return 0;

err_ipmap:
Expand Down
4 changes: 3 additions & 1 deletion trunk/net/sunrpc/sysctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include <linux/sunrpc/stats.h>
#include <linux/sunrpc/svc_xprt.h>

#include "netns.h"

/*
* Declare the debug flags here
*/
Expand Down Expand Up @@ -110,7 +112,7 @@ proc_dodebug(ctl_table *table, int write,
*(unsigned int *) table->data = value;
/* Display the RPC tasks on writing to rpc_debug */
if (strcmp(table->procname, "rpc_debug") == 0)
rpc_show_tasks();
rpc_show_tasks(&init_net);
} else {
if (!access_ok(VERIFY_WRITE, buffer, left))
return -EFAULT;
Expand Down

0 comments on commit 264e94e

Please sign in to comment.