Given timeout event can come during reset, nvme_dev_disable() shouldn't keep admin queue as quiesced after controller is shutdown. Otherwise it may block admin IO in reset, and cause reset hang forever. This patch fixes this issue by unquiescing admin queue at the end of nvme_dev_disable(). Cc: James Smart <james.smart@xxxxxxxxxxxx> Cc: Jianchao Wang <jianchao.w.wang@xxxxxxxxxx> Cc: Christoph Hellwig <hch@xxxxxx> Cc: Sagi Grimberg <sagi@xxxxxxxxxxx> Cc: linux-nvme@xxxxxxxxxxxxxxxxxxx Cc: Laurence Oberman <loberman@xxxxxxxxxx> Reported-by: Jianchao Wang <jianchao.w.wang@xxxxxxxxxx> Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx> --- drivers/nvme/host/pci.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index b60f727b844c..9e28d7118232 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -1557,8 +1557,7 @@ static int nvme_alloc_admin_tags(struct nvme_dev *dev) dev->ctrl.admin_q = NULL; return -ENODEV; } - } else - blk_mq_unquiesce_queue(dev->ctrl.admin_q); + } return 0; } @@ -2303,6 +2302,17 @@ static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown) */ if (shutdown) nvme_start_queues(&dev->ctrl); + + /* + * Avoid to stuck reset because timeout may happen during reset and + * reset may hang forever if admin queue is kept as quiesced. + * + * Druing reset, if admin queue isn't ready, the command will be + * failed immediately, that means we don't need to quiesce admin + * queue. + */ + if (dev->ctrl.admin_q) + blk_mq_unquiesce_queue(dev->ctrl.admin_q); mutex_unlock(&dev->shutdown_lock); } -- 2.9.5