aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2009-03-11 14:09:39 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2009-03-11 14:09:39 -0400
commit01d37c428ae080563c0a3bb8bdfa88c65a6891d3 (patch)
treebfc1c9a6336d4b7058c742d4a3178f8f588f5b66
parentfba91afbec2c004e2c8733ae9e0ca6998e962c64 (diff)
SUNRPC: xprt_connect() don't abort the task if the transport isn't bound
If the transport isn't bound, then we should just return ENOTCONN, letting call_connect_status() and/or call_status() deal with retrying. Currently, we appear to abort all pending tasks with an EIO error. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--net/sunrpc/xprt.c2
-rw-r--r--net/sunrpc/xprtsock.c13
2 files changed, 10 insertions, 5 deletions
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index 29e401bb612e..62098d101a1f 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -663,7 +663,7 @@ void xprt_connect(struct rpc_task *task)
663 xprt, (xprt_connected(xprt) ? "is" : "is not")); 663 xprt, (xprt_connected(xprt) ? "is" : "is not"));
664 664
665 if (!xprt_bound(xprt)) { 665 if (!xprt_bound(xprt)) {
666 task->tk_status = -EIO; 666 task->tk_status = -EAGAIN;
667 return; 667 return;
668 } 668 }
669 if (!xprt_lock_write(xprt, task)) 669 if (!xprt_lock_write(xprt, task))
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index a71fefd61910..29c71e645b27 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -577,6 +577,8 @@ static int xs_udp_send_request(struct rpc_task *task)
577 req->rq_svec->iov_base, 577 req->rq_svec->iov_base,
578 req->rq_svec->iov_len); 578 req->rq_svec->iov_len);
579 579
580 if (!xprt_bound(xprt))
581 return -ENOTCONN;
580 status = xs_sendpages(transport->sock, 582 status = xs_sendpages(transport->sock,
581 xs_addr(xprt), 583 xs_addr(xprt),
582 xprt->addrlen, xdr, 584 xprt->addrlen, xdr,
@@ -1531,7 +1533,7 @@ static void xs_udp_connect_worker4(struct work_struct *work)
1531 struct socket *sock = transport->sock; 1533 struct socket *sock = transport->sock;
1532 int err, status = -EIO; 1534 int err, status = -EIO;
1533 1535
1534 if (xprt->shutdown || !xprt_bound(xprt)) 1536 if (xprt->shutdown)
1535 goto out; 1537 goto out;
1536 1538
1537 /* Start by resetting any existing state */ 1539 /* Start by resetting any existing state */
@@ -1572,7 +1574,7 @@ static void xs_udp_connect_worker6(struct work_struct *work)
1572 struct socket *sock = transport->sock; 1574 struct socket *sock = transport->sock;
1573 int err, status = -EIO; 1575 int err, status = -EIO;
1574 1576
1575 if (xprt->shutdown || !xprt_bound(xprt)) 1577 if (xprt->shutdown)
1576 goto out; 1578 goto out;
1577 1579
1578 /* Start by resetting any existing state */ 1580 /* Start by resetting any existing state */
@@ -1656,6 +1658,9 @@ static int xs_tcp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock)
1656 write_unlock_bh(&sk->sk_callback_lock); 1658 write_unlock_bh(&sk->sk_callback_lock);
1657 } 1659 }
1658 1660
1661 if (!xprt_bound(xprt))
1662 return -ENOTCONN;
1663
1659 /* Tell the socket layer to start connecting... */ 1664 /* Tell the socket layer to start connecting... */
1660 xprt->stat.connect_count++; 1665 xprt->stat.connect_count++;
1661 xprt->stat.connect_start = jiffies; 1666 xprt->stat.connect_start = jiffies;
@@ -1676,7 +1681,7 @@ static void xs_tcp_connect_worker4(struct work_struct *work)
1676 struct socket *sock = transport->sock; 1681 struct socket *sock = transport->sock;
1677 int err, status = -EIO; 1682 int err, status = -EIO;
1678 1683
1679 if (xprt->shutdown || !xprt_bound(xprt)) 1684 if (xprt->shutdown)
1680 goto out; 1685 goto out;
1681 1686
1682 if (!sock) { 1687 if (!sock) {
@@ -1736,7 +1741,7 @@ static void xs_tcp_connect_worker6(struct work_struct *work)
1736 struct socket *sock = transport->sock; 1741 struct socket *sock = transport->sock;
1737 int err, status = -EIO; 1742 int err, status = -EIO;
1738 1743
1739 if (xprt->shutdown || !xprt_bound(xprt)) 1744 if (xprt->shutdown)
1740 goto out; 1745 goto out;
1741 1746
1742 if (!sock) { 1747 if (!sock) {