nvme/tcp: fix bug on double requeue when send fails
PATCH 1/1 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, );
--- drivers/nvme/host/tcp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/nvme/host/tcp.c +6 -1
@@ -1054,7 +1054,12 @@ static void nvme_tcp_io_work(struct work_struct *w) }else if (unlikely (result <0 )) {dev_err (queue->ctrl->ctrl.device,"failed to send request %d\n" , result); -if (result != -EPIPE ) + +/* +* Fail the request unless peer closed the connection, +* in which case error recovery flow will complete all. +*/ +if ((result != -EPIPE ) && (result != -ECONNRESET ))nvme_tcp_fail_request (queue->request);nvme_tcp_done_send_req (queue);return ;
Signature · 7 lines
2.14.1 _______________________________________________ linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Adding updated Keith's updated email:
_______________________________________________
linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Quoted 10 lines · Anton Eidelman
When
nvme_tcp_io_work()fails to send to socket due to connection close/reset,error_recoverywork is triggered fromnvme_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.
Quoted 6 lines
Double requeue caused BUG_ON(blk_queued_rq(rq))
inblk_mq_requeue_request()from either the individual requeue of the failed request or the bulk requeue fromblk_mq_tagset_busy_iter(, nvme_cancel_request, );Signed-off-by Anton Eidelman <[email protected]>
Thanks, applied to nvme-5.6-rc
_______________________________________________
linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme