diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-03-11 14:37:59 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-03-11 14:37:59 -0400 |
commit | c8485e4d634f6df155040293928707f127f0d06d (patch) | |
tree | 72ec8a7ea829e4f7df4648e646353c55a037e50e /net/sunrpc/xprtsock.c | |
parent | 40d2549db5f515e415894def98b49db7d4c56714 (diff) |
SUNRPC: Handle ECONNREFUSED correctly in xprt_transmit()
If we get an ECONNREFUSED error, we currently go to sleep on the
'xprt->sending' wait queue. The problem is that no timeout is set there,
and there is nothing else that will wake the task up later.
We should deal with ECONNREFUSED in call_status, given that is where we
also deal with -EHOSTDOWN, and friends.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/xprtsock.c')
-rw-r--r-- | net/sunrpc/xprtsock.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 9d1898f6ee87..5e8198bede81 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -594,6 +594,8 @@ static int xs_udp_send_request(struct rpc_task *task) | |||
594 | /* Still some bytes left; set up for a retry later. */ | 594 | /* Still some bytes left; set up for a retry later. */ |
595 | status = -EAGAIN; | 595 | status = -EAGAIN; |
596 | } | 596 | } |
597 | if (!transport->sock) | ||
598 | goto out; | ||
597 | 599 | ||
598 | switch (status) { | 600 | switch (status) { |
599 | case -ENOTSOCK: | 601 | case -ENOTSOCK: |
@@ -603,19 +605,17 @@ static int xs_udp_send_request(struct rpc_task *task) | |||
603 | case -EAGAIN: | 605 | case -EAGAIN: |
604 | xs_nospace(task); | 606 | xs_nospace(task); |
605 | break; | 607 | break; |
608 | default: | ||
609 | dprintk("RPC: sendmsg returned unrecognized error %d\n", | ||
610 | -status); | ||
606 | case -ENETUNREACH: | 611 | case -ENETUNREACH: |
607 | case -EPIPE: | 612 | case -EPIPE: |
608 | case -ECONNREFUSED: | 613 | case -ECONNREFUSED: |
609 | /* When the server has died, an ICMP port unreachable message | 614 | /* When the server has died, an ICMP port unreachable message |
610 | * prompts ECONNREFUSED. */ | 615 | * prompts ECONNREFUSED. */ |
611 | clear_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags); | 616 | clear_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags); |
612 | break; | ||
613 | default: | ||
614 | clear_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags); | ||
615 | dprintk("RPC: sendmsg returned unrecognized error %d\n", | ||
616 | -status); | ||
617 | } | 617 | } |
618 | 618 | out: | |
619 | return status; | 619 | return status; |
620 | } | 620 | } |
621 | 621 | ||
@@ -697,6 +697,8 @@ static int xs_tcp_send_request(struct rpc_task *task) | |||
697 | status = -EAGAIN; | 697 | status = -EAGAIN; |
698 | break; | 698 | break; |
699 | } | 699 | } |
700 | if (!transport->sock) | ||
701 | goto out; | ||
700 | 702 | ||
701 | switch (status) { | 703 | switch (status) { |
702 | case -ENOTSOCK: | 704 | case -ENOTSOCK: |
@@ -706,21 +708,17 @@ static int xs_tcp_send_request(struct rpc_task *task) | |||
706 | case -EAGAIN: | 708 | case -EAGAIN: |
707 | xs_nospace(task); | 709 | xs_nospace(task); |
708 | break; | 710 | break; |
711 | default: | ||
712 | dprintk("RPC: sendmsg returned unrecognized error %d\n", | ||
713 | -status); | ||
709 | case -ECONNRESET: | 714 | case -ECONNRESET: |
710 | xs_tcp_shutdown(xprt); | 715 | xs_tcp_shutdown(xprt); |
711 | case -ECONNREFUSED: | 716 | case -ECONNREFUSED: |
712 | case -ENOTCONN: | 717 | case -ENOTCONN: |
713 | case -EPIPE: | 718 | case -EPIPE: |
714 | status = -ENOTCONN; | ||
715 | clear_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags); | ||
716 | break; | ||
717 | default: | ||
718 | dprintk("RPC: sendmsg returned unrecognized error %d\n", | ||
719 | -status); | ||
720 | clear_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags); | 719 | clear_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags); |
721 | xs_tcp_shutdown(xprt); | ||
722 | } | 720 | } |
723 | 721 | out: | |
724 | return status; | 722 | return status; |
725 | } | 723 | } |
726 | 724 | ||