blk_mq_update_nr_hw_queues() freezes and unfreezes queues internally. When the queue is already frozen before this call, the freeze depth becomes 2. The internal unfreeze only decrements it to 1, leaving the queue still frozen when debugfs_create_files() is called. This triggers WARN_ON_ONCE(q->mq_freeze_depth != 0) in debugfs_create_files() and risks deadlock. Fix this by moving nvme_unfreeze() before blk_mq_update_nr_hw_queues() so the queue is unfrozen before the call, allowing the internal freeze/unfreeze to work correctly. Reported-by: Yi Zhang Closes: https://lore.kernel.org/all/CAHj4cs9gNKEYAPagD9JADfO5UH+OiCr4P7OO2wjpfOYeM-RV=A@mail.gmail.com/ Signed-off-by: Yu Kuai --- drivers/nvme/host/tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c index 69cb04406b47..daa02afbc9f5 100644 --- a/drivers/nvme/host/tcp.c +++ b/drivers/nvme/host/tcp.c @@ -2203,9 +2203,9 @@ static int nvme_tcp_configure_io_queues(struct nvme_ctrl *ctrl, bool new) nvme_unfreeze(ctrl); goto out_wait_freeze_timed_out; } + nvme_unfreeze(ctrl); blk_mq_update_nr_hw_queues(ctrl->tagset, ctrl->queue_count - 1); - nvme_unfreeze(ctrl); } /* -- 2.51.0