Skip to content

Commit 1a07031

Browse files
metze-sambasmfrench
authored andcommitted
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 <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>
1 parent a8e9703 commit 1a07031

File tree

3 files changed

+0
-19
lines changed

3 files changed

+0
-19
lines changed

fs/smb/client/cifs_debug.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,8 +498,6 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
498498
server->smbd_conn->receive_credit_target);
499499
seq_printf(m, "\nPending send_pending: %u ",
500500
atomic_read(&sc->send_io.pending.count));
501-
seq_printf(m, "\nReceive buffers count_receive_queue: %u ",
502-
server->smbd_conn->count_receive_queue);
503501
seq_printf(m, "\nMR responder_resources: %u "
504502
"max_frmr_depth: %u mr_type: 0x%x",
505503
server->smbd_conn->responder_resources,

fs/smb/client/smbdirect.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,6 @@ static void smbd_post_send_credits(struct work_struct *work)
541541
struct smbdirect_socket *sc = &info->socket;
542542

543543
if (sc->status != SMBDIRECT_SOCKET_CONNECTED) {
544-
wake_up_all(&info->wait_receive_queues);
545544
return;
546545
}
547546

@@ -1378,7 +1377,6 @@ static struct smbdirect_recv_io *get_receive_buffer(struct smbd_connection *info
13781377
&sc->recv_io.free.list,
13791378
struct smbdirect_recv_io, list);
13801379
list_del(&ret->list);
1381-
info->count_receive_queue--;
13821380
info->count_get_receive_buffer++;
13831381
}
13841382
spin_unlock_irqrestore(&sc->recv_io.free.lock, flags);
@@ -1408,7 +1406,6 @@ static void put_receive_buffer(
14081406

14091407
spin_lock_irqsave(&sc->recv_io.free.lock, flags);
14101408
list_add_tail(&response->list, &sc->recv_io.free.list);
1411-
info->count_receive_queue++;
14121409
info->count_put_receive_buffer++;
14131410
spin_unlock_irqrestore(&sc->recv_io.free.lock, flags);
14141411

@@ -1422,10 +1419,6 @@ static int allocate_receive_buffers(struct smbd_connection *info, int num_buf)
14221419
struct smbdirect_recv_io *response;
14231420
int i;
14241421

1425-
info->count_receive_queue = 0;
1426-
1427-
init_waitqueue_head(&info->wait_receive_queues);
1428-
14291422
for (i = 0; i < num_buf; i++) {
14301423
response = mempool_alloc(sc->recv_io.mem.pool, GFP_KERNEL);
14311424
if (!response)
@@ -1434,7 +1427,6 @@ static int allocate_receive_buffers(struct smbd_connection *info, int num_buf)
14341427
response->socket = sc;
14351428
response->sge.length = 0;
14361429
list_add_tail(&response->list, &sc->recv_io.free.list);
1437-
info->count_receive_queue++;
14381430
}
14391431

14401432
return 0;
@@ -1445,7 +1437,6 @@ static int allocate_receive_buffers(struct smbd_connection *info, int num_buf)
14451437
&sc->recv_io.free.list,
14461438
struct smbdirect_recv_io, list);
14471439
list_del(&response->list);
1448-
info->count_receive_queue--;
14491440

14501441
mempool_free(response, sc->recv_io.mem.pool);
14511442
}
@@ -1495,7 +1486,6 @@ void smbd_destroy(struct TCP_Server_Info *server)
14951486
{
14961487
struct smbd_connection *info = server->smbd_conn;
14971488
struct smbdirect_socket *sc;
1498-
struct smbdirect_socket_parameters *sp;
14991489
struct smbdirect_recv_io *response;
15001490
unsigned long flags;
15011491

@@ -1504,7 +1494,6 @@ void smbd_destroy(struct TCP_Server_Info *server)
15041494
return;
15051495
}
15061496
sc = &info->socket;
1507-
sp = &sc->parameters;
15081497

15091498
log_rdma_event(INFO, "cancelling and disable disconnect_work\n");
15101499
disable_work_sync(&sc->disconnect_work);
@@ -1546,8 +1535,6 @@ void smbd_destroy(struct TCP_Server_Info *server)
15461535
sc->recv_io.reassembly.data_length = 0;
15471536

15481537
log_rdma_event(INFO, "free receive buffers\n");
1549-
wait_event(info->wait_receive_queues,
1550-
info->count_receive_queue == sp->recv_credit_max);
15511538
destroy_receive_buffers(info);
15521539

15531540
/*

fs/smb/client/smbdirect.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,6 @@ struct smbd_connection {
8181
/* Used by transport to wait until all MRs are returned */
8282
wait_queue_head_t wait_for_mr_cleanup;
8383

84-
/* Receive queue */
85-
int count_receive_queue;
86-
wait_queue_head_t wait_receive_queues;
87-
8884
bool send_immediate;
8985

9086
struct workqueue_struct *workqueue;

0 commit comments

Comments
 (0)