]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
smb: client: remove info->wait_receive_queues handling in smbd_destroy()
authorStefan Metzmacher <metze@samba.org>
Tue, 12 Aug 2025 07:24:57 +0000 (09:24 +0200)
committerSteve French <stfrench@microsoft.com>
Sun, 28 Sep 2025 23:29:49 +0000 (18:29 -0500)
We already call ib_drain_qp() before, which is an sync operation
that only returns in the queues are fully drained.

ib_drain_qp() completes pending requests with IB_WC_WR_FLUSH_ERR
so we have already called put_receive_buffer().

So all smbdirect_recv_io objects are either in the
smbdirect_socket.recv_io.free.list or
smbdirect_socket.recv_io.reassembly.list.

Then we explicitly iterate smbdirect_socket.recv_io.reassembly.list
and call put_receive_buffer(), so every object is
in smbdirect_socket.recv_io.free.list.

It means info->count_receive_queue == sp->recv_credit_max was
already true and calling wait_event(info->wait_receive_queues...
is pointless.

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

index 01a582e172cbf923a600cddb155bb6f6502f936e..a40846500de6b82eec1b78c24b91a8b35d3b913c 100644 (file)
@@ -498,8 +498,6 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
                        server->smbd_conn->receive_credit_target);
                seq_printf(m, "\nPending send_pending: %u ",
                        atomic_read(&sc->send_io.pending.count));
-               seq_printf(m, "\nReceive buffers count_receive_queue: %u ",
-                       server->smbd_conn->count_receive_queue);
                seq_printf(m, "\nMR responder_resources: %u "
                        "max_frmr_depth: %u mr_type: 0x%x",
                        server->smbd_conn->responder_resources,
index 0ec09841362f5cda74ce98c305d8dd1526897478..df032ed70af56b8aad2c470220f5f35dcffe8948 100644 (file)
@@ -541,7 +541,6 @@ static void smbd_post_send_credits(struct work_struct *work)
        struct smbdirect_socket *sc = &info->socket;
 
        if (sc->status != SMBDIRECT_SOCKET_CONNECTED) {
-               wake_up_all(&info->wait_receive_queues);
                return;
        }
 
@@ -1378,7 +1377,6 @@ static struct smbdirect_recv_io *get_receive_buffer(struct smbd_connection *info
                        &sc->recv_io.free.list,
                        struct smbdirect_recv_io, list);
                list_del(&ret->list);
-               info->count_receive_queue--;
                info->count_get_receive_buffer++;
        }
        spin_unlock_irqrestore(&sc->recv_io.free.lock, flags);
@@ -1408,7 +1406,6 @@ static void put_receive_buffer(
 
        spin_lock_irqsave(&sc->recv_io.free.lock, flags);
        list_add_tail(&response->list, &sc->recv_io.free.list);
-       info->count_receive_queue++;
        info->count_put_receive_buffer++;
        spin_unlock_irqrestore(&sc->recv_io.free.lock, flags);
 
@@ -1422,10 +1419,6 @@ static int allocate_receive_buffers(struct smbd_connection *info, int num_buf)
        struct smbdirect_recv_io *response;
        int i;
 
-       info->count_receive_queue = 0;
-
-       init_waitqueue_head(&info->wait_receive_queues);
-
        for (i = 0; i < num_buf; i++) {
                response = mempool_alloc(sc->recv_io.mem.pool, GFP_KERNEL);
                if (!response)
@@ -1434,7 +1427,6 @@ static int allocate_receive_buffers(struct smbd_connection *info, int num_buf)
                response->socket = sc;
                response->sge.length = 0;
                list_add_tail(&response->list, &sc->recv_io.free.list);
-               info->count_receive_queue++;
        }
 
        return 0;
@@ -1445,7 +1437,6 @@ allocate_failed:
                                &sc->recv_io.free.list,
                                struct smbdirect_recv_io, list);
                list_del(&response->list);
-               info->count_receive_queue--;
 
                mempool_free(response, sc->recv_io.mem.pool);
        }
@@ -1495,7 +1486,6 @@ void smbd_destroy(struct TCP_Server_Info *server)
 {
        struct smbd_connection *info = server->smbd_conn;
        struct smbdirect_socket *sc;
-       struct smbdirect_socket_parameters *sp;
        struct smbdirect_recv_io *response;
        unsigned long flags;
 
@@ -1504,7 +1494,6 @@ void smbd_destroy(struct TCP_Server_Info *server)
                return;
        }
        sc = &info->socket;
-       sp = &sc->parameters;
 
        log_rdma_event(INFO, "cancelling and disable disconnect_work\n");
        disable_work_sync(&sc->disconnect_work);
@@ -1546,8 +1535,6 @@ void smbd_destroy(struct TCP_Server_Info *server)
        sc->recv_io.reassembly.data_length = 0;
 
        log_rdma_event(INFO, "free receive buffers\n");
-       wait_event(info->wait_receive_queues,
-               info->count_receive_queue == sp->recv_credit_max);
        destroy_receive_buffers(info);
 
        /*
index 7075bdc92193b9f47476245b6d5e571101fe0643..0b6e968c3d917d064b3204a4a989ae85c65b6967 100644 (file)
@@ -81,10 +81,6 @@ struct smbd_connection {
        /* Used by transport to wait until all MRs are returned */
        wait_queue_head_t wait_for_mr_cleanup;
 
-       /* Receive queue */
-       int count_receive_queue;
-       wait_queue_head_t wait_receive_queues;
-
        bool send_immediate;
 
        struct workqueue_struct *workqueue;