Skip to content

Commit cf76785

Browse files
author
Trond Myklebust
committed
SUNRPC: Fix a race with XPRT_CONNECTING
Ensure that we clear XPRT_CONNECTING before releasing the XPRT_LOCK so that we don't have races between the (asynchronous) socket setup code and tasks in xprt_connect(). Signed-off-by: Trond Myklebust <[email protected]> Tested-by: Chuck Lever <[email protected]>
1 parent 0445f92 commit cf76785

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/sunrpc/xprtsock.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2090,8 +2090,8 @@ static void xs_udp_setup_socket(struct work_struct *work)
20902090
trace_rpc_socket_connect(xprt, sock, 0);
20912091
status = 0;
20922092
out:
2093-
xprt_unlock_connect(xprt, transport);
20942093
xprt_clear_connecting(xprt);
2094+
xprt_unlock_connect(xprt, transport);
20952095
xprt_wake_pending_tasks(xprt, status);
20962096
}
20972097

@@ -2327,8 +2327,8 @@ static void xs_tcp_setup_socket(struct work_struct *work)
23272327
}
23282328
status = -EAGAIN;
23292329
out:
2330-
xprt_unlock_connect(xprt, transport);
23312330
xprt_clear_connecting(xprt);
2331+
xprt_unlock_connect(xprt, transport);
23322332
xprt_wake_pending_tasks(xprt, status);
23332333
}
23342334

0 commit comments

Comments
 (0)