diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-06-09 19:39:12 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-07-10 23:40:29 -0400 |
commit | 848f1fe6be2e290691bb6c13cbb8fd92bd0cfaab (patch) | |
tree | d653340b5e0c8c6ce393e67b11d8958fab4b05e4 | |
parent | 34f52e3591f241b825353ba27def956d8487c400 (diff) |
SUNRPC: Kill rpc_clnt->cl_dead
Its use is at best racy, and there is only one user (lockd), which has
additional locking that makes the whole thing redundant.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | include/linux/sunrpc/clnt.h | 3 | ||||
-rw-r--r-- | net/sunrpc/clnt.c | 18 |
2 files changed, 4 insertions, 17 deletions
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index 003d8ea70c19..ab3ef6d629a7 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h | |||
@@ -45,8 +45,7 @@ struct rpc_clnt { | |||
45 | cl_intr : 1,/* interruptible */ | 45 | cl_intr : 1,/* interruptible */ |
46 | cl_discrtry : 1,/* disconnect before retry */ | 46 | cl_discrtry : 1,/* disconnect before retry */ |
47 | cl_autobind : 1,/* use getport() */ | 47 | cl_autobind : 1,/* use getport() */ |
48 | cl_oneshot : 1,/* dispose after use */ | 48 | cl_oneshot : 1;/* dispose after use */ |
49 | cl_dead : 1;/* abandoned */ | ||
50 | 49 | ||
51 | struct rpc_rtt * cl_rtt; /* RTO estimator data */ | 50 | struct rpc_rtt * cl_rtt; /* RTO estimator data */ |
52 | 51 | ||
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 254a6e1a5770..fb65249538d4 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -286,7 +286,6 @@ rpc_clone_client(struct rpc_clnt *clnt) | |||
286 | /* Turn off autobind on clones */ | 286 | /* Turn off autobind on clones */ |
287 | new->cl_autobind = 0; | 287 | new->cl_autobind = 0; |
288 | new->cl_oneshot = 0; | 288 | new->cl_oneshot = 0; |
289 | new->cl_dead = 0; | ||
290 | INIT_LIST_HEAD(&new->cl_tasks); | 289 | INIT_LIST_HEAD(&new->cl_tasks); |
291 | spin_lock_init(&new->cl_lock); | 290 | spin_lock_init(&new->cl_lock); |
292 | rpc_init_rtt(&new->cl_rtt_default, clnt->cl_xprt->timeout.to_initval); | 291 | rpc_init_rtt(&new->cl_rtt_default, clnt->cl_xprt->timeout.to_initval); |
@@ -305,9 +304,8 @@ out_no_clnt: | |||
305 | 304 | ||
306 | /* | 305 | /* |
307 | * Properly shut down an RPC client, terminating all outstanding | 306 | * Properly shut down an RPC client, terminating all outstanding |
308 | * requests. Note that we must be certain that cl_oneshot and | 307 | * requests. Note that we must be certain that cl_oneshot is cleared, |
309 | * cl_dead are cleared, or else the client would be destroyed | 308 | * or else the client would be destroyed when the last task releases it. |
310 | * when the last task releases it. | ||
311 | */ | 309 | */ |
312 | int | 310 | int |
313 | rpc_shutdown_client(struct rpc_clnt *clnt) | 311 | rpc_shutdown_client(struct rpc_clnt *clnt) |
@@ -318,7 +316,6 @@ rpc_shutdown_client(struct rpc_clnt *clnt) | |||
318 | while (!list_empty(&clnt->cl_tasks)) { | 316 | while (!list_empty(&clnt->cl_tasks)) { |
319 | /* Don't let rpc_release_client destroy us */ | 317 | /* Don't let rpc_release_client destroy us */ |
320 | clnt->cl_oneshot = 0; | 318 | clnt->cl_oneshot = 0; |
321 | clnt->cl_dead = 0; | ||
322 | rpc_killall_tasks(clnt); | 319 | rpc_killall_tasks(clnt); |
323 | wait_event_timeout(destroy_wait, | 320 | wait_event_timeout(destroy_wait, |
324 | list_empty(&clnt->cl_tasks), 1*HZ); | 321 | list_empty(&clnt->cl_tasks), 1*HZ); |
@@ -369,7 +366,7 @@ rpc_release_client(struct rpc_clnt *clnt) | |||
369 | 366 | ||
370 | if (list_empty(&clnt->cl_tasks)) | 367 | if (list_empty(&clnt->cl_tasks)) |
371 | wake_up(&destroy_wait); | 368 | wake_up(&destroy_wait); |
372 | if (clnt->cl_oneshot || clnt->cl_dead) | 369 | if (clnt->cl_oneshot) |
373 | rpc_destroy_client(clnt); | 370 | rpc_destroy_client(clnt); |
374 | kref_put(&clnt->cl_kref, rpc_free_client); | 371 | kref_put(&clnt->cl_kref, rpc_free_client); |
375 | } | 372 | } |
@@ -483,10 +480,6 @@ int rpc_call_sync(struct rpc_clnt *clnt, struct rpc_message *msg, int flags) | |||
483 | sigset_t oldset; | 480 | sigset_t oldset; |
484 | int status; | 481 | int status; |
485 | 482 | ||
486 | /* If this client is slain all further I/O fails */ | ||
487 | if (clnt->cl_dead) | ||
488 | return -EIO; | ||
489 | |||
490 | BUG_ON(flags & RPC_TASK_ASYNC); | 483 | BUG_ON(flags & RPC_TASK_ASYNC); |
491 | 484 | ||
492 | task = rpc_new_task(clnt, flags, &rpc_default_ops, NULL); | 485 | task = rpc_new_task(clnt, flags, &rpc_default_ops, NULL); |
@@ -519,11 +512,6 @@ rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg, int flags, | |||
519 | sigset_t oldset; | 512 | sigset_t oldset; |
520 | int status; | 513 | int status; |
521 | 514 | ||
522 | /* If this client is slain all further I/O fails */ | ||
523 | status = -EIO; | ||
524 | if (clnt->cl_dead) | ||
525 | goto out_release; | ||
526 | |||
527 | flags |= RPC_TASK_ASYNC; | 515 | flags |= RPC_TASK_ASYNC; |
528 | 516 | ||
529 | /* Create/initialize a new RPC task */ | 517 | /* Create/initialize a new RPC task */ |