Skip to contentSkip to conversation

smb: server: let free_transport() wait for SMBDIRECT_SOCKET_DISCONNECTED

PATCH Applied Stefan Metzmacher 2 participants 2 messages Oct 15, 2025 – Oct 16, 2025

Subsystems (3)
lore
Share & tools
lore

Stefan Metzmacher

author reviewer
#0 lore raw

PATCH 1/1 smb: server: let free_transport() wait for SMBDIRECT_SOCKET_DISCONNECTED

We should wait for the rdma_cm to become SMBDIRECT_SOCKET_DISCONNECTED!

At least on the client side (with similar code) wait_event_interruptible() often returns with -ERESTARTSYS instead of waiting for SMBDIRECT_SOCKET_DISCONNECTED.
We should use wait_event() here too, which makes the code be identical in client and server, which will help when moving to common functions.

Fixes b31606097de8 ("smb: server: move smb_direct_disconnect_rdma_work() into free_transport()")
Cc Namjae Jeon <[email protected]>
Cc Steve French <[email protected]>
Cc Tom Talpey <[email protected]>
---
 fs/smb/server/transport_rdma.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
fs/smb/server/transport_rdma.c +3 -4
index a201c5871a77..94851ff25a02 100644
@@ -450,11 +450,10 @@ static void free_transport(struct smb_direct_transport *t)
 	struct smbdirect_recv_io *recvmsg;
 
 	disable_work_sync(&sc->disconnect_work);
-	if (sc->status < SMBDIRECT_SOCKET_DISCONNECTING) {
+	if (sc->status < SMBDIRECT_SOCKET_DISCONNECTING)
 		smb_direct_disconnect_rdma_work(&sc->disconnect_work);
-		wait_event_interruptible(sc->status_wait,
-					 sc->status == SMBDIRECT_SOCKET_DISCONNECTED);
-	}
+	if (sc->status < SMBDIRECT_SOCKET_DISCONNECTED)
+		wait_event(sc->status_wait, sc->status == SMBDIRECT_SOCKET_DISCONNECTED);
 
 	/*
 	 * Wake up all waiters in all wait queues
Signature · 1 line
2.43.0
maintainer Applied
#1 lore raw
Quoted 9 lines · Stefan Metzmacher

We should wait for the rdma_cm to become SMBDIRECT_SOCKET_DISCONNECTED!

At least on the client side (with similar code) wait_event_interruptible() often returns with -ERESTARTSYS instead of waiting for SMBDIRECT_SOCKET_DISCONNECTED.
We should use wait_event() here too, which makes the code be identical in client and server, which will help when moving to common functions.

Quoted 7 lines
Fixes b31606097de8 ("smb: server: move smb_direct_disconnect_rdma_work() into free_transport()")
Cc Namjae Jeon <[email protected]>
Cc Steve French <[email protected]>
Cc Tom Talpey <[email protected]>

Applied it to #ksmbd-for-next-next.
Thanks!