Skip to content

Commit 01d37c4

Browse files
Trond MyklebustTrond Myklebust
authored andcommitted
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>
1 parent fba91af commit 01d37c4

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

net/sunrpc/xprt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ void xprt_connect(struct rpc_task *task)
663663
xprt, (xprt_connected(xprt) ? "is" : "is not"));
664664

665665
if (!xprt_bound(xprt)) {
666-
task->tk_status = -EIO;
666+
task->tk_status = -EAGAIN;
667667
return;
668668
}
669669
if (!xprt_lock_write(xprt, task))

net/sunrpc/xprtsock.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,8 @@ static int xs_udp_send_request(struct rpc_task *task)
577577
req->rq_svec->iov_base,
578578
req->rq_svec->iov_len);
579579

580+
if (!xprt_bound(xprt))
581+
return -ENOTCONN;
580582
status = xs_sendpages(transport->sock,
581583
xs_addr(xprt),
582584
xprt->addrlen, xdr,
@@ -1531,7 +1533,7 @@ static void xs_udp_connect_worker4(struct work_struct *work)
15311533
struct socket *sock = transport->sock;
15321534
int err, status = -EIO;
15331535

1534-
if (xprt->shutdown || !xprt_bound(xprt))
1536+
if (xprt->shutdown)
15351537
goto out;
15361538

15371539
/* Start by resetting any existing state */
@@ -1572,7 +1574,7 @@ static void xs_udp_connect_worker6(struct work_struct *work)
15721574
struct socket *sock = transport->sock;
15731575
int err, status = -EIO;
15741576

1575-
if (xprt->shutdown || !xprt_bound(xprt))
1577+
if (xprt->shutdown)
15761578
goto out;
15771579

15781580
/* Start by resetting any existing state */
@@ -1656,6 +1658,9 @@ static int xs_tcp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock)
16561658
write_unlock_bh(&sk->sk_callback_lock);
16571659
}
16581660

1661+
if (!xprt_bound(xprt))
1662+
return -ENOTCONN;
1663+
16591664
/* Tell the socket layer to start connecting... */
16601665
xprt->stat.connect_count++;
16611666
xprt->stat.connect_start = jiffies;
@@ -1676,7 +1681,7 @@ static void xs_tcp_connect_worker4(struct work_struct *work)
16761681
struct socket *sock = transport->sock;
16771682
int err, status = -EIO;
16781683

1679-
if (xprt->shutdown || !xprt_bound(xprt))
1684+
if (xprt->shutdown)
16801685
goto out;
16811686

16821687
if (!sock) {
@@ -1736,7 +1741,7 @@ static void xs_tcp_connect_worker6(struct work_struct *work)
17361741
struct socket *sock = transport->sock;
17371742
int err, status = -EIO;
17381743

1739-
if (xprt->shutdown || !xprt_bound(xprt))
1744+
if (xprt->shutdown)
17401745
goto out;
17411746

17421747
if (!sock) {

0 commit comments

Comments
 (0)