Skip to content

Commit a0fdd14

Browse files
keithbuschChristoph Hellwig
authored andcommitted
nvme-tcp: rerun io_work if req_list is not empty
A possible race condition exists where the request to send data is enqueued from nvme_tcp_handle_r2t()'s will not be observed by nvme_tcp_send_all() if it happens to be running. The driver relies on io_work to send the enqueued request when it is runs again, but the concurrently running nvme_tcp_send_all() may not have released the send_mutex at that time. If no future commands are enqueued to re-kick the io_work, the request will timeout in the SEND_H2C state, resulting in a timeout error like: nvme nvme0: queue 1: timeout request 0x3 type 6 Ensure the io_work continues to run as long as the req_list is not empty. Fixes: db5ad6b ("nvme-tcp: try to send request in queue_rq context") Signed-off-by: Keith Busch <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
1 parent 825619b commit a0fdd14

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/nvme/host/tcp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1140,7 +1140,8 @@ static void nvme_tcp_io_work(struct work_struct *w)
11401140
pending = true;
11411141
else if (unlikely(result < 0))
11421142
break;
1143-
}
1143+
} else
1144+
pending = !llist_empty(&queue->req_list);
11441145

11451146
result = nvme_tcp_try_recv(queue);
11461147
if (result > 0)

0 commit comments

Comments
 (0)