Skip to content

Commit 2d570a7

Browse files
anton-lbaxboe
authored andcommitted
nvme/tcp: fix bug on double requeue when send fails
When nvme_tcp_io_work() fails to send to socket due to connection close/reset, error_recovery work is triggered from nvme_tcp_state_change() socket callback. This cancels all the active requests in the tagset, which requeues them. The failed request, however, was ended and thus requeued individually as well unless send returned -EPIPE. Another return code to be treated the same way is -ECONNRESET. Double requeue caused BUG_ON(blk_queued_rq(rq)) in blk_mq_requeue_request() from either the individual requeue of the failed request or the bulk requeue from blk_mq_tagset_busy_iter(, nvme_cancel_request, ); Signed-off-by: Anton Eidelman <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Signed-off-by: Keith Busch <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 4ec31cb commit 2d570a7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/nvme/host/tcp.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,12 @@ static void nvme_tcp_io_work(struct work_struct *w)
10541054
} else if (unlikely(result < 0)) {
10551055
dev_err(queue->ctrl->ctrl.device,
10561056
"failed to send request %d\n", result);
1057-
if (result != -EPIPE)
1057+
1058+
/*
1059+
* Fail the request unless peer closed the connection,
1060+
* in which case error recovery flow will complete all.
1061+
*/
1062+
if ((result != -EPIPE) && (result != -ECONNRESET))
10581063
nvme_tcp_fail_request(queue->request);
10591064
nvme_tcp_done_send_req(queue);
10601065
return;

0 commit comments

Comments
 (0)