[PATCH 3/8] nvme-tcp: re-init request list entries

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


From: Hannes Reinecke <hare at suse.de>

When removing entries from a list we should re-init the list entries
to allow for checking if the entries are still on the list.

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

diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index 7876bf7d2fac..04d840709d5d 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -412,11 +412,13 @@ static inline void nvme_tcp_queue_request(struct nvme_tcp_request *req,
 static void nvme_tcp_process_req_list(struct nvme_tcp_queue *queue)
 {
 	struct nvme_tcp_request *req;
-	struct llist_node *node;
+	struct llist_node *node, *next;
 
-	for (node = llist_del_all(&queue->req_list); node; node = node->next) {
+	for (node = llist_del_all(&queue->req_list); node; node = next) {
 		req = llist_entry(node, struct nvme_tcp_request, lentry);
 		list_add(&req->entry, &queue->send_list);
+		next = node->next;
+		init_llist_node(node);
 	}
 }
 
@@ -435,7 +437,7 @@ nvme_tcp_fetch_request(struct nvme_tcp_queue *queue)
 			return NULL;
 	}
 
-	list_del(&req->entry);
+	list_del_init(&req->entry);
 	return req;
 }
 
-- 
2.35.3




More information about the Linux-nvme mailing list