Commit 1a07031f authored by Stefan Metzmacher's avatar Stefan Metzmacher Committed by Steve French
Browse files

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: default avatarNamjae Jeon <linkinjeon@kernel.org>
Signed-off-by: default avatarStefan Metzmacher <metze@samba.org>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent a8e97035
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -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,
+0 −13
Original line number Diff line number Diff line
@@ -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 @@ static int allocate_receive_buffers(struct smbd_connection *info, int num_buf)
				&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);

	/*
+0 −4
Original line number Diff line number Diff line
@@ -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;