summaryrefslogtreecommitdiff
path: root/fs/smb/common
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2025-11-24 14:49:55 +0100
committerSteve French <stfrench@microsoft.com>2026-04-15 21:58:24 -0500
commita40e6f0166e6d5fef4dd7d3b71c333319a0964ab (patch)
tree1a623c624423226a22809b4315cd5d780c10d888 /fs/smb/common
parent33b2894e8df76f7faf7253d8784515415511968f (diff)
downloadlwn-a40e6f0166e6d5fef4dd7d3b71c333319a0964ab.tar.gz
lwn-a40e6f0166e6d5fef4dd7d3b71c333319a0964ab.zip
smb: smbdirect: wrap rdma_disconnect() in rdma_[un]lock_handler()
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>
Diffstat (limited to 'fs/smb/common')
-rw-r--r--fs/smb/common/smbdirect/smbdirect_socket.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/fs/smb/common/smbdirect/smbdirect_socket.c b/fs/smb/common/smbdirect/smbdirect_socket.c
index 63cdfccedd55..f69c290f36ca 100644
--- a/fs/smb/common/smbdirect/smbdirect_socket.c
+++ b/fs/smb/common/smbdirect/smbdirect_socket.c
@@ -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: