Commit 0a660521 authored by Trond Myklebust's avatar Trond Myklebust

SUNRPC: Don't set the request connect_cookie until a successful transmit

We're using the request connect_cookie to track whether or not a
request was successfully transmitted on the current transport
connection or not. For that reason we should ensure that it is
only set after we've successfully transmitted the request.
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 8b71798c
...@@ -912,7 +912,6 @@ void xprt_transmit(struct rpc_task *task) ...@@ -912,7 +912,6 @@ void xprt_transmit(struct rpc_task *task)
} else if (!req->rq_bytes_sent) } else if (!req->rq_bytes_sent)
return; return;
req->rq_connect_cookie = xprt->connect_cookie;
req->rq_xtime = ktime_get(); req->rq_xtime = ktime_get();
status = xprt->ops->send_request(task); status = xprt->ops->send_request(task);
if (status != 0) { if (status != 0) {
...@@ -938,12 +937,14 @@ void xprt_transmit(struct rpc_task *task) ...@@ -938,12 +937,14 @@ void xprt_transmit(struct rpc_task *task)
/* Don't race with disconnect */ /* Don't race with disconnect */
if (!xprt_connected(xprt)) if (!xprt_connected(xprt))
task->tk_status = -ENOTCONN; task->tk_status = -ENOTCONN;
else if (!req->rq_reply_bytes_recvd && rpc_reply_expected(task)) { else {
/* /*
* Sleep on the pending queue since * Sleep on the pending queue since
* we're expecting a reply. * we're expecting a reply.
*/ */
rpc_sleep_on(&xprt->pending, task, xprt_timer); if (!req->rq_reply_bytes_recvd && rpc_reply_expected(task))
rpc_sleep_on(&xprt->pending, task, xprt_timer);
req->rq_connect_cookie = xprt->connect_cookie;
} }
spin_unlock_bh(&xprt->transport_lock); spin_unlock_bh(&xprt->transport_lock);
} }
...@@ -1186,6 +1187,7 @@ static void xprt_request_init(struct rpc_task *task, struct rpc_xprt *xprt) ...@@ -1186,6 +1187,7 @@ static void xprt_request_init(struct rpc_task *task, struct rpc_xprt *xprt)
req->rq_xprt = xprt; req->rq_xprt = xprt;
req->rq_buffer = NULL; req->rq_buffer = NULL;
req->rq_xid = xprt_alloc_xid(xprt); req->rq_xid = xprt_alloc_xid(xprt);
req->rq_connect_cookie = xprt->connect_cookie - 1;
req->rq_release_snd_buf = NULL; req->rq_release_snd_buf = NULL;
xprt_reset_majortimeo(req); xprt_reset_majortimeo(req);
dprintk("RPC: %5u reserved req %p xid %08x\n", task->tk_pid, dprintk("RPC: %5u reserved req %p xid %08x\n", task->tk_pid,
......
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