diff options
| author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-09-04 21:51:44 -0400 |
|---|---|---|
| committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-09-05 10:13:15 -0400 |
| commit | 2f048db4680ae19da13df15d352ac02748781ecb (patch) | |
| tree | 48a6c8d873fee159186f528438bdfeecd6b48d84 | |
| parent | 8d1018c7745e5ab861cd6cfd3dc4fa425b90575d (diff) | |
SUNRPC: Add an identifier for struct rpc_clnt
Add an identifier in order to aid debugging.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
| -rw-r--r-- | include/linux/sunrpc/clnt.h | 1 | ||||
| -rw-r--r-- | net/sunrpc/clnt.c | 25 |
2 files changed, 26 insertions, 0 deletions
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index 76c0bf6ecd17..6740801aa71a 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h | |||
| @@ -33,6 +33,7 @@ struct rpc_inode; | |||
| 33 | */ | 33 | */ |
| 34 | struct rpc_clnt { | 34 | struct rpc_clnt { |
| 35 | atomic_t cl_count; /* Number of references */ | 35 | atomic_t cl_count; /* Number of references */ |
| 36 | unsigned int cl_clid; /* client id */ | ||
| 36 | struct list_head cl_clients; /* Global list of clients */ | 37 | struct list_head cl_clients; /* Global list of clients */ |
| 37 | struct list_head cl_tasks; /* List of tasks */ | 38 | struct list_head cl_tasks; /* List of tasks */ |
| 38 | spinlock_t cl_lock; /* spinlock */ | 39 | spinlock_t cl_lock; /* spinlock */ |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 0cd5b6d5c75e..0a790690d142 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
| @@ -313,6 +313,24 @@ out: | |||
| 313 | return err; | 313 | return err; |
| 314 | } | 314 | } |
| 315 | 315 | ||
| 316 | static DEFINE_IDA(rpc_clids); | ||
| 317 | |||
| 318 | static int rpc_alloc_clid(struct rpc_clnt *clnt) | ||
| 319 | { | ||
| 320 | int clid; | ||
| 321 | |||
| 322 | clid = ida_simple_get(&rpc_clids, 0, 0, GFP_KERNEL); | ||
| 323 | if (clid < 0) | ||
| 324 | return clid; | ||
| 325 | clnt->cl_clid = clid; | ||
| 326 | return 0; | ||
| 327 | } | ||
| 328 | |||
| 329 | static void rpc_free_clid(struct rpc_clnt *clnt) | ||
| 330 | { | ||
| 331 | ida_simple_remove(&rpc_clids, clnt->cl_clid); | ||
| 332 | } | ||
| 333 | |||
| 316 | static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args, | 334 | static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args, |
| 317 | struct rpc_xprt *xprt, | 335 | struct rpc_xprt *xprt, |
| 318 | struct rpc_clnt *parent) | 336 | struct rpc_clnt *parent) |
| @@ -343,6 +361,10 @@ static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args, | |||
| 343 | goto out_err; | 361 | goto out_err; |
| 344 | clnt->cl_parent = parent ? : clnt; | 362 | clnt->cl_parent = parent ? : clnt; |
| 345 | 363 | ||
| 364 | err = rpc_alloc_clid(clnt); | ||
| 365 | if (err) | ||
| 366 | goto out_no_clid; | ||
| 367 | |||
| 346 | rcu_assign_pointer(clnt->cl_xprt, xprt); | 368 | rcu_assign_pointer(clnt->cl_xprt, xprt); |
| 347 | clnt->cl_procinfo = version->procs; | 369 | clnt->cl_procinfo = version->procs; |
| 348 | clnt->cl_maxproc = version->nrprocs; | 370 | clnt->cl_maxproc = version->nrprocs; |
| @@ -386,6 +408,8 @@ static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args, | |||
| 386 | out_no_path: | 408 | out_no_path: |
| 387 | rpc_free_iostats(clnt->cl_metrics); | 409 | rpc_free_iostats(clnt->cl_metrics); |
| 388 | out_no_stats: | 410 | out_no_stats: |
| 411 | rpc_free_clid(clnt); | ||
| 412 | out_no_clid: | ||
| 389 | kfree(clnt); | 413 | kfree(clnt); |
| 390 | out_err: | 414 | out_err: |
| 391 | rpciod_down(); | 415 | rpciod_down(); |
| @@ -646,6 +670,7 @@ rpc_free_client(struct rpc_clnt *clnt) | |||
| 646 | clnt->cl_metrics = NULL; | 670 | clnt->cl_metrics = NULL; |
| 647 | xprt_put(rcu_dereference_raw(clnt->cl_xprt)); | 671 | xprt_put(rcu_dereference_raw(clnt->cl_xprt)); |
| 648 | rpciod_down(); | 672 | rpciod_down(); |
| 673 | rpc_free_clid(clnt); | ||
| 649 | kfree(clnt); | 674 | kfree(clnt); |
| 650 | } | 675 | } |
| 651 | 676 | ||
