]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
smb: client: initialize recv_io->cqe.done = recv_done just once
authorStefan Metzmacher <metze@samba.org>
Wed, 17 Sep 2025 06:54:03 +0000 (08:54 +0200)
committerSteve French <stfrench@microsoft.com>
Thu, 16 Apr 2026 02:58:21 +0000 (21:58 -0500)
smbdirect_recv_io structures are pre-allocated so we can set the
callback function just once.

This will make it easy to move smbd_post_recv() to common code
soon.

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/client/smbdirect.c

index 6f60bed49d70ec0d678efd1ac1a76ace37b726ae..6ba2c252ff1e772429c51cd946be6183ce336c9b 100644 (file)
@@ -1325,8 +1325,6 @@ static int smbd_post_recv(
        response->sge.length = sp->max_recv_size;
        response->sge.lkey = sc->ib.pd->local_dma_lkey;
 
-       response->cqe.done = recv_done;
-
        recv_wr.wr_cqe = &response->cqe;
        recv_wr.next = NULL;
        recv_wr.sg_list = &response->sge;
@@ -1534,6 +1532,7 @@ static struct smbd_connection *_smbd_get_connection(
        __be32 ird_ord_hdr[2];
        char wq_name[80];
        struct workqueue_struct *workqueue;
+       struct smbdirect_recv_io *recv_io;
 
        /*
         * Create the initial parameters
@@ -1638,6 +1637,9 @@ static struct smbd_connection *_smbd_get_connection(
                goto allocate_cache_failed;
        }
 
+       list_for_each_entry(recv_io, &sc->recv_io.free.list, list)
+               recv_io->cqe.done = recv_done;
+
        INIT_WORK(&sc->idle.immediate_work, send_immediate_empty_message);
        /*
         * start with the negotiate timeout and SMBDIRECT_KEEPALIVE_PENDING