[PATCH 7/8] nvme-tcp: check for SOCK_NOSPACE before sending

Hannes Reinecke hare at kernel.org
Tue Jul 16 00:36:15 PDT 2024


From: Hannes Reinecke <hare at suse.de>

It's pointless to try to sent if we don't have enough space; we'll
be notified by the 'write_space' callback anyway.

Signed-off-by: Hannes Reinecke <hare at kernel.org>
---
 drivers/nvme/host/tcp.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index 9634c16d7bc0..f3a94168b2c3 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -1424,7 +1424,11 @@ static int nvme_tcp_try_send(struct nvme_tcp_queue *queue)
 	}
 	req = queue->request;
 
+	if (test_bit(SOCK_NOSPACE, &queue->sock->flags))
+		return 0;
+
 	noreclaim_flag = memalloc_noreclaim_save();
+
 	if (req->state == NVME_TCP_SEND_CMD_PDU) {
 		ret = nvme_tcp_try_send_cmd_pdu(req);
 		if (ret <= 0)
-- 
2.35.3




More information about the Linux-nvme mailing list