]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
smb: smbdirect: wrap rdma_disconnect() in rdma_[un]lock_handler()
authorStefan Metzmacher <metze@samba.org>
Mon, 24 Nov 2025 13:49:55 +0000 (14:49 +0100)
committerSteve French <stfrench@microsoft.com>
Thu, 16 Apr 2026 02:58:24 +0000 (21:58 -0500)
This might not be needed, but it controls the order
of ib_drain_qp() and rdma_disconnect().

Cc: Steve French <smfrench@gmail.com>
Cc: Tom Talpey <tom@talpey.com>
Cc: Long Li <longli@microsoft.com>
Cc: Namjae Jeon <linkinjeon@kernel.org>
Cc: linux-cifs@vger.kernel.org
Cc: samba-technical@lists.samba.org
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/common/smbdirect/smbdirect_socket.c

index 63cdfccedd55c8c3efdb4bd222d3adf6abf9e5e2..f69c290f36caeb9966c8bfaedd159c9c6cad3cff 100644 (file)
@@ -474,7 +474,20 @@ static void smbdirect_socket_cleanup_work(struct work_struct *work)
        case SMBDIRECT_SOCKET_CONNECTED:
        case SMBDIRECT_SOCKET_ERROR:
                sc->status = SMBDIRECT_SOCKET_DISCONNECTING;
+               /*
+                * Make sure we hold the callback lock
+                * im order to coordinate with the
+                * rdma_event handlers, typically
+                * smbdirect_connection_rdma_event_handler(),
+                * and smbdirect_socket_destroy().
+                *
+                * So that the order of ib_drain_qp()
+                * and rdma_disconnect() is controlled
+                * by the mutex.
+                */
+               rdma_lock_handler(sc->rdma.cm_id);
                rdma_disconnect(sc->rdma.cm_id);
+               rdma_unlock_handler(sc->rdma.cm_id);
                break;
 
        case SMBDIRECT_SOCKET_CREATED: