aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/xprtsock.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2009-03-11 14:38:00 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2009-03-11 14:38:00 -0400
commit2a4919919a97911b0aa4b9f5ac1eab90ba87652b (patch)
treec12eb42c34f0d0b79130ae93ebd56159e8366ee8 /net/sunrpc/xprtsock.c
parent482f32e65d31cbf88d08306fa5d397cc945c3c26 (diff)
SUNRPC: Return EAGAIN instead of ENOTCONN when waking up xprt->pending
While we should definitely return socket errors to the task that is currently trying to send data, there is no need to propagate the same error to all the other tasks on xprt->pending. Doing so actually slows down recovery, since it causes more than one tasks to attempt socket recovery. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/xprtsock.c')
-rw-r--r--net/sunrpc/xprtsock.c58
1 files changed, 31 insertions, 27 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 879af6f27b4..8e58b0b5460 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1162,7 +1162,7 @@ static void xs_tcp_state_change(struct sock *sk)
1162 transport->tcp_flags = 1162 transport->tcp_flags =
1163 TCP_RCV_COPY_FRAGHDR | TCP_RCV_COPY_XID; 1163 TCP_RCV_COPY_FRAGHDR | TCP_RCV_COPY_XID;
1164 1164
1165 xprt_wake_pending_tasks(xprt, 0); 1165 xprt_wake_pending_tasks(xprt, -EAGAIN);
1166 } 1166 }
1167 spin_unlock_bh(&xprt->transport_lock); 1167 spin_unlock_bh(&xprt->transport_lock);
1168 break; 1168 break;
@@ -1721,20 +1721,22 @@ static void xs_tcp_connect_worker4(struct work_struct *work)
1721 dprintk("RPC: %p connect status %d connected %d sock state %d\n", 1721 dprintk("RPC: %p connect status %d connected %d sock state %d\n",
1722 xprt, -status, xprt_connected(xprt), 1722 xprt, -status, xprt_connected(xprt),
1723 sock->sk->sk_state); 1723 sock->sk->sk_state);
1724 if (status < 0) { 1724 switch (status) {
1725 switch (status) { 1725 case 0:
1726 case -EINPROGRESS: 1726 case -EINPROGRESS:
1727 case -EALREADY: 1727 case -EALREADY:
1728 goto out_clear; 1728 goto out_clear;
1729 case -ECONNREFUSED: 1729 case -ECONNREFUSED:
1730 case -ECONNRESET: 1730 case -ECONNRESET:
1731 /* retry with existing socket, after a delay */ 1731 /* retry with existing socket, after a delay */
1732 break; 1732 break;
1733 default: 1733 default:
1734 /* get rid of existing socket, and retry */ 1734 /* get rid of existing socket, and retry */
1735 xs_tcp_shutdown(xprt); 1735 xs_tcp_shutdown(xprt);
1736 } 1736 printk("%s: connect returned unhandled error %d\n",
1737 __func__, status);
1737 } 1738 }
1739 status = -EAGAIN;
1738out: 1740out:
1739 xprt_wake_pending_tasks(xprt, status); 1741 xprt_wake_pending_tasks(xprt, status);
1740out_clear: 1742out_clear:
@@ -1780,20 +1782,22 @@ static void xs_tcp_connect_worker6(struct work_struct *work)
1780 status = xs_tcp_finish_connecting(xprt, sock); 1782 status = xs_tcp_finish_connecting(xprt, sock);
1781 dprintk("RPC: %p connect status %d connected %d sock state %d\n", 1783 dprintk("RPC: %p connect status %d connected %d sock state %d\n",
1782 xprt, -status, xprt_connected(xprt), sock->sk->sk_state); 1784 xprt, -status, xprt_connected(xprt), sock->sk->sk_state);
1783 if (status < 0) { 1785 switch (status) {
1784 switch (status) { 1786 case 0:
1785 case -EINPROGRESS: 1787 case -EINPROGRESS:
1786 case -EALREADY: 1788 case -EALREADY:
1787 goto out_clear; 1789 goto out_clear;
1788 case -ECONNREFUSED: 1790 case -ECONNREFUSED:
1789 case -ECONNRESET: 1791 case -ECONNRESET:
1790 /* retry with existing socket, after a delay */ 1792 /* retry with existing socket, after a delay */
1791 break; 1793 break;
1792 default: 1794 default:
1793 /* get rid of existing socket, and retry */ 1795 /* get rid of existing socket, and retry */
1794 xs_tcp_shutdown(xprt); 1796 xs_tcp_shutdown(xprt);
1795 } 1797 printk("%s: connect returned unhandled error %d\n",
1798 __func__, status);
1796 } 1799 }
1800 status = -EAGAIN;
1797out: 1801out:
1798 xprt_wake_pending_tasks(xprt, status); 1802 xprt_wake_pending_tasks(xprt, status);
1799out_clear: 1803out_clear: