Skip to content

Commit 3be232f

Browse files
author
Trond Myklebust
committed
SUNRPC: Prevent immediate close+reconnect
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 <[email protected]>
1 parent d896ba8 commit 3be232f

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

net/sunrpc/xprt.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,8 @@ EXPORT_SYMBOL_GPL(xprt_disconnect_done);
767767
*/
768768
static void xprt_schedule_autoclose_locked(struct rpc_xprt *xprt)
769769
{
770-
set_bit(XPRT_CLOSE_WAIT, &xprt->state);
770+
if (test_and_set_bit(XPRT_CLOSE_WAIT, &xprt->state))
771+
return;
771772
if (test_and_set_bit(XPRT_LOCKED, &xprt->state) == 0)
772773
queue_work(xprtiod_workqueue, &xprt->task_cleanup);
773774
else if (xprt->snd_task && !test_bit(XPRT_SND_IS_COOKIE, &xprt->state))

net/sunrpc/xprtsock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2314,7 +2314,7 @@ static void xs_connect(struct rpc_xprt *xprt, struct rpc_task *task)
23142314

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

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

0 commit comments

Comments
 (0)