Skip to content

Commit

Permalink
SUNRPC: Prevent immediate close+reconnect
Browse files Browse the repository at this point in the history
If we have already set up the socket and are waiting for it to connect,
then don't immediately close and retry.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
  • Loading branch information
Trond Myklebust committed Nov 4, 2021
1 parent d896ba8 commit 3be232f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion net/sunrpc/xprt.c
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,8 @@ EXPORT_SYMBOL_GPL(xprt_disconnect_done);
*/
static void xprt_schedule_autoclose_locked(struct rpc_xprt *xprt)
{
set_bit(XPRT_CLOSE_WAIT, &xprt->state);
if (test_and_set_bit(XPRT_CLOSE_WAIT, &xprt->state))
return;
if (test_and_set_bit(XPRT_LOCKED, &xprt->state) == 0)
queue_work(xprtiod_workqueue, &xprt->task_cleanup);
else if (xprt->snd_task && !test_bit(XPRT_SND_IS_COOKIE, &xprt->state))
Expand Down
2 changes: 1 addition & 1 deletion net/sunrpc/xprtsock.c
Original file line number Diff line number Diff line change
Expand Up @@ -2314,7 +2314,7 @@ static void xs_connect(struct rpc_xprt *xprt, struct rpc_task *task)

WARN_ON_ONCE(!xprt_lock_connect(xprt, task, transport));

if (transport->sock != NULL) {
if (transport->sock != NULL && !xprt_connecting(xprt)) {
dprintk("RPC: xs_connect delayed xprt %p for %lu "
"seconds\n",
xprt, xprt->reestablish_timeout / HZ);
Expand Down

0 comments on commit 3be232f

Please sign in to comment.