Skip to content

Commit 2875b0a

Browse files
sagigrimbergChristoph Hellwig
authored andcommitted
nvme-tcp: fix controller reset hang during traffic
commit fe35ec5 ("block: update hctx map when use multiple maps") exposed an issue where we may hang trying to wait for queue freeze during I/O. We call blk_mq_update_nr_hw_queues which in case of multiple queue maps (which we have now for default/read/poll) is attempting to freeze the queue. However we never started queue freeze when starting the reset, which means that we have inflight pending requests that entered the queue that we will not complete once the queue is quiesced. So start a freeze before we quiesce the queue, and unfreeze the queue after we successfully connected the I/O queues (and make sure to call blk_mq_update_nr_hw_queues only after we are sure that the queue was already frozen). This follows to how the pci driver handles resets. Fixes: fe35ec5 ("block: update hctx map when use multiple maps") Signed-off-by: Sagi Grimberg <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
1 parent d9174c1 commit 2875b0a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

drivers/nvme/host/tcp.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1771,15 +1771,20 @@ static int nvme_tcp_configure_io_queues(struct nvme_ctrl *ctrl, bool new)
17711771
ret = PTR_ERR(ctrl->connect_q);
17721772
goto out_free_tag_set;
17731773
}
1774-
} else {
1775-
blk_mq_update_nr_hw_queues(ctrl->tagset,
1776-
ctrl->queue_count - 1);
17771774
}
17781775

17791776
ret = nvme_tcp_start_io_queues(ctrl);
17801777
if (ret)
17811778
goto out_cleanup_connect_q;
17821779

1780+
if (!new) {
1781+
nvme_start_queues(ctrl);
1782+
nvme_wait_freeze(ctrl);
1783+
blk_mq_update_nr_hw_queues(ctrl->tagset,
1784+
ctrl->queue_count - 1);
1785+
nvme_unfreeze(ctrl);
1786+
}
1787+
17831788
return 0;
17841789

17851790
out_cleanup_connect_q:
@@ -1884,6 +1889,7 @@ static void nvme_tcp_teardown_io_queues(struct nvme_ctrl *ctrl,
18841889
{
18851890
if (ctrl->queue_count <= 1)
18861891
return;
1892+
nvme_start_freeze(ctrl);
18871893
nvme_stop_queues(ctrl);
18881894
nvme_tcp_stop_io_queues(ctrl);
18891895
if (ctrl->tagset) {

0 commit comments

Comments
 (0)