Skip to content

Commit 4d6c671

Browse files
author
Trond Myklebust
committed
SUNRPC: Take the transport send lock before binding+connecting
Before trying to bind a port, ensure we grab the send lock to ensure that we don't change the port while another task is busy transmitting requests. The connect code already takes the send lock in xprt_connect(), but it is harmless to take it before that. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
1 parent 009a82f commit 4d6c671

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

net/sunrpc/clnt.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1867,6 +1867,9 @@ call_bind(struct rpc_task *task)
18671867
dprint_status(task);
18681868

18691869
task->tk_action = call_bind_status;
1870+
if (!xprt_prepare_transmit(task))
1871+
return;
1872+
18701873
task->tk_timeout = xprt->bind_timeout;
18711874
xprt->ops->rpcbind(task);
18721875
}
@@ -1911,6 +1914,8 @@ call_bind_status(struct rpc_task *task)
19111914
task->tk_rebind_retry--;
19121915
rpc_delay(task, 3*HZ);
19131916
goto retry_timeout;
1917+
case -EAGAIN:
1918+
goto retry_timeout;
19141919
case -ETIMEDOUT:
19151920
dprintk("RPC: %5u rpcbind request timed out\n",
19161921
task->tk_pid);
@@ -1952,7 +1957,7 @@ call_bind_status(struct rpc_task *task)
19521957

19531958
retry_timeout:
19541959
task->tk_status = 0;
1955-
task->tk_action = call_encode;
1960+
task->tk_action = call_bind;
19561961
rpc_check_timeout(task);
19571962
}
19581963

@@ -1986,6 +1991,8 @@ call_connect(struct rpc_task *task)
19861991
rpc_exit(task, -ENOTCONN);
19871992
return;
19881993
}
1994+
if (!xprt_prepare_transmit(task))
1995+
return;
19891996
xprt_connect(task);
19901997
}
19911998

0 commit comments

Comments
 (0)