Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0695314e authored by Trond Myklebust's avatar Trond Myklebust
Browse files

SUNRPC: Fix a regression when reconnecting



If the task needs to give up the socket lock in order to allow a
reconnect to occur, then it must also clear the 'rq_bytes_sent' field
so that when it retransmits, it knows to start from the beginning.

Fixes: 718ba5b8 ("SUNRPC: Add helpers to prevent socket create from racing")
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent 09a330f4
Loading
Loading
Loading
Loading
+12 −10
Original line number Diff line number Diff line
@@ -326,6 +326,15 @@ static void __xprt_lock_write_next_cong(struct rpc_xprt *xprt)
	xprt_clear_locked(xprt);
}

static void xprt_task_clear_bytes_sent(struct rpc_task *task)
{
	if (task != NULL) {
		struct rpc_rqst *req = task->tk_rqstp;
		if (req != NULL)
			req->rq_bytes_sent = 0;
	}
}

/**
 * xprt_release_xprt - allow other requests to use a transport
 * @xprt: transport with other tasks potentially waiting
@@ -336,11 +345,7 @@ static void __xprt_lock_write_next_cong(struct rpc_xprt *xprt)
void xprt_release_xprt(struct rpc_xprt *xprt, struct rpc_task *task)
{
	if (xprt->snd_task == task) {
		if (task != NULL) {
			struct rpc_rqst *req = task->tk_rqstp;
			if (req != NULL)
				req->rq_bytes_sent = 0;
		}
		xprt_task_clear_bytes_sent(task);
		xprt_clear_locked(xprt);
		__xprt_lock_write_next(xprt);
	}
@@ -358,11 +363,7 @@ EXPORT_SYMBOL_GPL(xprt_release_xprt);
void xprt_release_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task)
{
	if (xprt->snd_task == task) {
		if (task != NULL) {
			struct rpc_rqst *req = task->tk_rqstp;
			if (req != NULL)
				req->rq_bytes_sent = 0;
		}
		xprt_task_clear_bytes_sent(task);
		xprt_clear_locked(xprt);
		__xprt_lock_write_next_cong(xprt);
	}
@@ -700,6 +701,7 @@ bool xprt_lock_connect(struct rpc_xprt *xprt,
		goto out;
	if (xprt->snd_task != task)
		goto out;
	xprt_task_clear_bytes_sent(task);
	xprt->snd_task = cookie;
	ret = true;
out: