]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
nvme-pci: move nvme_kill_queues to nvme_remove_dead_ctrl
authorJianchao Wang <jianchao.w.wang@oracle.com>
Wed, 20 Jun 2018 05:42:22 +0000 (13:42 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 24 Aug 2018 11:06:46 +0000 (13:06 +0200)
commitfc2a7f6fb8dcba5c633935cce08b49677451edd8
treecf59e782f8f81e59cf9f5bbb1f81ecf970225d19
parenta3cb0606588a3c41c1fee278b508efa71420f111
nvme-pci: move nvme_kill_queues to nvme_remove_dead_ctrl

[ Upstream commit 9f9cafc14016f23f982d3ce18f9057923bd3037a ]

There is race between nvme_remove and nvme_reset_work that can
lead to io hang.

nvme_remove                    nvme_reset_work
                               -> nvme_remove_dead_ctrl
                                 -> nvme_dev_disable
                                   -> quiesce request_queue
                                 -> queue remove_work
-> cancel_work_sync reset_work
-> nvme_remove_namespaces
  -> splice ctrl->namespaces
                               nvme_remove_dead_ctrl_work
                               -> nvme_kill_queues
  -> nvme_ns_remove               do nothing
    -> blk_cleanup_queue
      -> blk_freeze_queue

Finally, the request_queue is quiesced state when wait freeze,
we will get io hang here. To fix it, move the nvme_kill_queues
from nvme_remove_dead_ctrl_work to nvme_remove_dead_ctrl.

Suggested-by: Keith Busch <keith.busch@linux.intel.com>
Signed-off-by: Jianchao Wang <jianchao.w.wang@oracle.com>
Reviewed-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/nvme/host/pci.c