]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
smb: server: let smb_direct_flush_send_list() invalidate a remote key first
authorStefan Metzmacher <metze@samba.org>
Mon, 8 Sep 2025 20:22:35 +0000 (22:22 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Oct 2025 13:04:36 +0000 (14:04 +0100)
[ Upstream commit 1b53426334c3c942db47e0959a2527a4f815af50 ]

If we want to invalidate a remote key we should do that as soon as
possible, so do it in the first send work request.

Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Cc: Steve French <smfrench@gmail.com>
Cc: Tom Talpey <tom@talpey.com>
Cc: linux-cifs@vger.kernel.org
Cc: samba-technical@lists.samba.org
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/smb/server/transport_rdma.c

index af1c41f922bb31610f49d1bd59fff2bd1f72039c..81da8a5c1e0db8ae34fe2304d2a2733c9010ccf1 100644 (file)
@@ -933,12 +933,15 @@ static int smb_direct_flush_send_list(struct smb_direct_transport *t,
                               struct smb_direct_sendmsg,
                               list);
 
+       if (send_ctx->need_invalidate_rkey) {
+               first->wr.opcode = IB_WR_SEND_WITH_INV;
+               first->wr.ex.invalidate_rkey = send_ctx->remote_key;
+               send_ctx->need_invalidate_rkey = false;
+               send_ctx->remote_key = 0;
+       }
+
        last->wr.send_flags = IB_SEND_SIGNALED;
        last->wr.wr_cqe = &last->cqe;
-       if (is_last && send_ctx->need_invalidate_rkey) {
-               last->wr.opcode = IB_WR_SEND_WITH_INV;
-               last->wr.ex.invalidate_rkey = send_ctx->remote_key;
-       }
 
        ret = smb_direct_post_send(t, &first->wr);
        if (!ret) {