Commit 5e3771ce authored by Trond Myklebust's avatar Trond Myklebust

SUNRPC: Ensure that xs_nospace return values are propagated

If xs_nospace() finds that the socket has disconnected, it attempts to
return ENOTCONN, however that value is then squashed by the callers.
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 8a2cec29
...@@ -521,11 +521,12 @@ static void xs_nospace_callback(struct rpc_task *task) ...@@ -521,11 +521,12 @@ static void xs_nospace_callback(struct rpc_task *task)
* @task: task to put to sleep * @task: task to put to sleep
* *
*/ */
static void xs_nospace(struct rpc_task *task) static int xs_nospace(struct rpc_task *task)
{ {
struct rpc_rqst *req = task->tk_rqstp; struct rpc_rqst *req = task->tk_rqstp;
struct rpc_xprt *xprt = req->rq_xprt; struct rpc_xprt *xprt = req->rq_xprt;
struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt);
int ret = 0;
dprintk("RPC: %5u xmit incomplete (%u left of %u)\n", dprintk("RPC: %5u xmit incomplete (%u left of %u)\n",
task->tk_pid, req->rq_slen - req->rq_bytes_sent, task->tk_pid, req->rq_slen - req->rq_bytes_sent,
...@@ -537,6 +538,7 @@ static void xs_nospace(struct rpc_task *task) ...@@ -537,6 +538,7 @@ static void xs_nospace(struct rpc_task *task)
/* Don't race with disconnect */ /* Don't race with disconnect */
if (xprt_connected(xprt)) { if (xprt_connected(xprt)) {
if (test_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags)) { if (test_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags)) {
ret = -EAGAIN;
/* /*
* Notify TCP that we're limited by the application * Notify TCP that we're limited by the application
* window size * window size
...@@ -548,10 +550,11 @@ static void xs_nospace(struct rpc_task *task) ...@@ -548,10 +550,11 @@ static void xs_nospace(struct rpc_task *task)
} }
} else { } else {
clear_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags); clear_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags);
task->tk_status = -ENOTCONN; ret = -ENOTCONN;
} }
spin_unlock_bh(&xprt->transport_lock); spin_unlock_bh(&xprt->transport_lock);
return ret;
} }
/** /**
...@@ -603,7 +606,7 @@ static int xs_udp_send_request(struct rpc_task *task) ...@@ -603,7 +606,7 @@ static int xs_udp_send_request(struct rpc_task *task)
/* Should we call xs_close() here? */ /* Should we call xs_close() here? */
break; break;
case -EAGAIN: case -EAGAIN:
xs_nospace(task); status = xs_nospace(task);
break; break;
default: default:
dprintk("RPC: sendmsg returned unrecognized error %d\n", dprintk("RPC: sendmsg returned unrecognized error %d\n",
...@@ -706,7 +709,7 @@ static int xs_tcp_send_request(struct rpc_task *task) ...@@ -706,7 +709,7 @@ static int xs_tcp_send_request(struct rpc_task *task)
/* Should we call xs_close() here? */ /* Should we call xs_close() here? */
break; break;
case -EAGAIN: case -EAGAIN:
xs_nospace(task); status = xs_nospace(task);
break; break;
default: default:
dprintk("RPC: sendmsg returned unrecognized error %d\n", dprintk("RPC: sendmsg returned unrecognized error %d\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment