diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-01-03 03:55:56 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-01-06 14:58:58 -0500 |
commit | 0065db328533c390fbfb0fe0c46bcf9a278fb99e (patch) | |
tree | 3ef282aa05653857007760ce15a4119f198f8320 /net/sunrpc/xprt.c | |
parent | 632e3bdc5006334cea894d078660b691685e1075 (diff) |
SUNRPC: Clean up xprt_destroy()
We ought never to be calling xprt_destroy() if there are still active
rpc_tasks. Optimise away the broken code that attempts to "fix" that case.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/xprt.c')
-rw-r--r-- | net/sunrpc/xprt.c | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 8bc0d5acf0da..8ff2c8acb223 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c | |||
@@ -534,10 +534,6 @@ void xprt_connect(struct rpc_task *task) | |||
534 | dprintk("RPC: %4d xprt_connect xprt %p %s connected\n", task->tk_pid, | 534 | dprintk("RPC: %4d xprt_connect xprt %p %s connected\n", task->tk_pid, |
535 | xprt, (xprt_connected(xprt) ? "is" : "is not")); | 535 | xprt, (xprt_connected(xprt) ? "is" : "is not")); |
536 | 536 | ||
537 | if (xprt->shutdown) { | ||
538 | task->tk_status = -EIO; | ||
539 | return; | ||
540 | } | ||
541 | if (!xprt->addr.sin_port) { | 537 | if (!xprt->addr.sin_port) { |
542 | task->tk_status = -EIO; | 538 | task->tk_status = -EIO; |
543 | return; | 539 | return; |
@@ -686,9 +682,6 @@ int xprt_prepare_transmit(struct rpc_task *task) | |||
686 | 682 | ||
687 | dprintk("RPC: %4d xprt_prepare_transmit\n", task->tk_pid); | 683 | dprintk("RPC: %4d xprt_prepare_transmit\n", task->tk_pid); |
688 | 684 | ||
689 | if (xprt->shutdown) | ||
690 | return -EIO; | ||
691 | |||
692 | spin_lock_bh(&xprt->transport_lock); | 685 | spin_lock_bh(&xprt->transport_lock); |
693 | if (req->rq_received && !req->rq_bytes_sent) { | 686 | if (req->rq_received && !req->rq_bytes_sent) { |
694 | err = req->rq_received; | 687 | err = req->rq_received; |
@@ -813,11 +806,9 @@ void xprt_reserve(struct rpc_task *task) | |||
813 | struct rpc_xprt *xprt = task->tk_xprt; | 806 | struct rpc_xprt *xprt = task->tk_xprt; |
814 | 807 | ||
815 | task->tk_status = -EIO; | 808 | task->tk_status = -EIO; |
816 | if (!xprt->shutdown) { | 809 | spin_lock(&xprt->reserve_lock); |
817 | spin_lock(&xprt->reserve_lock); | 810 | do_xprt_reserve(task); |
818 | do_xprt_reserve(task); | 811 | spin_unlock(&xprt->reserve_lock); |
819 | spin_unlock(&xprt->reserve_lock); | ||
820 | } | ||
821 | } | 812 | } |
822 | 813 | ||
823 | static inline u32 xprt_alloc_xid(struct rpc_xprt *xprt) | 814 | static inline u32 xprt_alloc_xid(struct rpc_xprt *xprt) |
@@ -864,7 +855,7 @@ void xprt_release(struct rpc_task *task) | |||
864 | if (!list_empty(&req->rq_list)) | 855 | if (!list_empty(&req->rq_list)) |
865 | list_del(&req->rq_list); | 856 | list_del(&req->rq_list); |
866 | xprt->last_used = jiffies; | 857 | xprt->last_used = jiffies; |
867 | if (list_empty(&xprt->recv) && !xprt->shutdown) | 858 | if (list_empty(&xprt->recv)) |
868 | mod_timer(&xprt->timer, | 859 | mod_timer(&xprt->timer, |
869 | xprt->last_used + xprt->idle_timeout); | 860 | xprt->last_used + xprt->idle_timeout); |
870 | spin_unlock_bh(&xprt->transport_lock); | 861 | spin_unlock_bh(&xprt->transport_lock); |
@@ -976,16 +967,6 @@ struct rpc_xprt *xprt_create_proto(int proto, struct sockaddr_in *sap, struct rp | |||
976 | return xprt; | 967 | return xprt; |
977 | } | 968 | } |
978 | 969 | ||
979 | static void xprt_shutdown(struct rpc_xprt *xprt) | ||
980 | { | ||
981 | xprt->shutdown = 1; | ||
982 | rpc_wake_up(&xprt->sending); | ||
983 | rpc_wake_up(&xprt->resend); | ||
984 | xprt_wake_pending_tasks(xprt, -EIO); | ||
985 | rpc_wake_up(&xprt->backlog); | ||
986 | del_timer_sync(&xprt->timer); | ||
987 | } | ||
988 | |||
989 | /** | 970 | /** |
990 | * xprt_destroy - destroy an RPC transport, killing off all requests. | 971 | * xprt_destroy - destroy an RPC transport, killing off all requests. |
991 | * @xprt: transport to destroy | 972 | * @xprt: transport to destroy |
@@ -994,7 +975,8 @@ static void xprt_shutdown(struct rpc_xprt *xprt) | |||
994 | int xprt_destroy(struct rpc_xprt *xprt) | 975 | int xprt_destroy(struct rpc_xprt *xprt) |
995 | { | 976 | { |
996 | dprintk("RPC: destroying transport %p\n", xprt); | 977 | dprintk("RPC: destroying transport %p\n", xprt); |
997 | xprt_shutdown(xprt); | 978 | xprt->shutdown = 1; |
979 | del_timer_sync(&xprt->timer); | ||
998 | xprt->ops->destroy(xprt); | 980 | xprt->ops->destroy(xprt); |
999 | kfree(xprt); | 981 | kfree(xprt); |
1000 | 982 | ||