Skip to contentSkip to conversation

smb: client: let smbd_destroy() wait for SMBDIRECT_SOCKET_DISCONNECTED

PATCH In review Stefan Metzmacher 2 participants 2 messages Oct 15, 2025

Subsystems (3)
lore
Share & tools
lore

Stefan Metzmacher

author reviewer
#0 lore raw

PATCH 1/1 smb: client: let smbd_destroy() wait for SMBDIRECT_SOCKET_DISCONNECTED

We should wait for the rdma_cm to become SMBDIRECT_SOCKET_DISCONNECTED, it turns out that (at least running some xfstests e.g. cifs/001) often triggers the case where wait_event_interruptible() returns with -ERESTARTSYS instead of waiting for SMBDIRECT_SOCKET_DISCONNECTED to be reached.

Or we are already in SMBDIRECT_SOCKET_DISCONNECTING and never wait for SMBDIRECT_SOCKET_DISCONNECTED.

Fixes 050b8c374019 ("smbd: Make upper layer decide when to destroy the transport")
Fixes e8b3bfe9bc65 ("cifs: smbd: Don't destroy transport on RDMA disconnect")
Fixes b0aa92a229ab ("smb: client: make sure smbd_disconnect_rdma_work() doesn't run after smbd_destroy() took over")
Cc Steve French <[email protected]>
Cc Tom Talpey <[email protected]>
Cc Long Li <[email protected]>
Cc Namjae Jeon <[email protected]>
---
 fs/smb/client/smbdirect.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
fs/smb/client/smbdirect.c +4 -4
index 77de85d7cdc3..49e2df3ad1f0 100644
@@ -1575,12 +1575,12 @@ void smbd_destroy(struct TCP_Server_Info *server)
 	disable_work_sync(&sc->disconnect_work);
 
 	log_rdma_event(INFO, "destroying rdma session\n");
-	if (sc->status < SMBDIRECT_SOCKET_DISCONNECTING) {
+	if (sc->status < SMBDIRECT_SOCKET_DISCONNECTING)
 		smbd_disconnect_rdma_work(&sc->disconnect_work);
+	if (sc->status < SMBDIRECT_SOCKET_DISCONNECTED) {
 		log_rdma_event(INFO, "wait for transport being disconnected\n");
-		wait_event_interruptible(
-			sc->status_wait,
-			sc->status == SMBDIRECT_SOCKET_DISCONNECTED);
+		wait_event(sc->status_wait, sc->status == SMBDIRECT_SOCKET_DISCONNECTED);
+		log_rdma_event(INFO, "waited for transport being disconnected\n");
 	}
 
 	/*
Signature · 1 line
2.43.0
#1 lore raw

merged into cifs-2.6.git for-next pending more review and testing

Quoted 48 lines · Stefan Metzmacher

We should wait for the rdma_cm to become SMBDIRECT_SOCKET_DISCONNECTED, it turns out that (at least running some xfstests e.g. cifs/001) often triggers the case where wait_event_interruptible() returns with -ERESTARTSYS instead of waiting for SMBDIRECT_SOCKET_DISCONNECTED to be reached.

Or we are already in SMBDIRECT_SOCKET_DISCONNECTING and never wait for SMBDIRECT_SOCKET_DISCONNECTED.

Fixes 050b8c374019 ("smbd: Make upper layer decide when to destroy the transport")
Fixes e8b3bfe9bc65 ("cifs: smbd: Don't destroy transport on RDMA disconnect")
Fixes b0aa92a229ab ("smb: client: make sure smbd_disconnect_rdma_work() doesn't run after smbd_destroy() took over")
Cc Steve French <[email protected]>
Cc Tom Talpey <[email protected]>
Cc Long Li <[email protected]>
Cc Namjae Jeon <[email protected]>
---
 fs/smb/client/smbdirect.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
fs/smb/client/smbdirect.c +4 -5
index 77de85d7cdc3..49e2df3ad1f0 100644
@@ -1575,12 +1575,12 @@ void smbd_destroy(struct TCP_Server_Info *server)
        disable_work_sync(&sc->disconnect_work);
 
        log_rdma_event(INFO, "destroying rdma session\n");
-       if (sc->status < SMBDIRECT_SOCKET_DISCONNECTING) {
+       if (sc->status < SMBDIRECT_SOCKET_DISCONNECTING)
                smbd_disconnect_rdma_work(&sc->disconnect_work);
+       if (sc->status < SMBDIRECT_SOCKET_DISCONNECTED) {
                log_rdma_event(INFO, "wait for transport being disconnected\n");
-               wait_event_interruptible(
-                       sc->status_wait,
-                       sc->status == SMBDIRECT_SOCKET_DISCONNECTED);
+               wait_event(sc->status_wait, sc->status == SMBDIRECT_SOCKET_DISCONNECTED);
+               log_rdma_event(INFO, "waited for transport being disconnected\n");
        }
 
        /*
--

2.43.0

Signature · 3 lines
Thanks,

Steve