From: Stefan Metzmacher Date: Tue, 12 Aug 2025 07:24:57 +0000 (+0200) Subject: smb: client: remove info->wait_receive_queues handling in smbd_destroy() X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1a07031fdd56754747a27b48d555152e1daf19cd;p=thirdparty%2Fkernel%2Fstable.git smb: client: remove info->wait_receive_queues handling in smbd_destroy() 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 Cc: Tom Talpey Cc: Long Li Cc: linux-cifs@vger.kernel.org Cc: samba-technical@lists.samba.org Acked-by: Namjae Jeon Signed-off-by: Stefan Metzmacher Signed-off-by: Steve French --- diff --git a/fs/smb/client/cifs_debug.c b/fs/smb/client/cifs_debug.c index 01a582e172cbf..a40846500de6b 100644 --- a/fs/smb/client/cifs_debug.c +++ b/fs/smb/client/cifs_debug.c @@ -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, diff --git a/fs/smb/client/smbdirect.c b/fs/smb/client/smbdirect.c index 0ec09841362f5..df032ed70af56 100644 --- a/fs/smb/client/smbdirect.c +++ b/fs/smb/client/smbdirect.c @@ -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); /* diff --git a/fs/smb/client/smbdirect.h b/fs/smb/client/smbdirect.h index 7075bdc92193b..0b6e968c3d917 100644 --- a/fs/smb/client/smbdirect.h +++ b/fs/smb/client/smbdirect.h @@ -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;