nvme/core: Fix race kicking freed request_queue
Subsystems (2)
PATCH 1/2 nvme/core: Fix race kicking freed request_queue
commit f33447b90e96076483525b21cc4e0a8977cdd07c upstream.
If a namespace has already been marked dead, we don't want to kick the request_queue again since we may have just freed it from another thread.
Cc <[email protected]> # 4.9+
Signed-off-by Keith Busch <[email protected]>
Reviewed-by Johannes Thumshirn <[email protected]>
Reviewed-by Christoph Hellwig <[email protected]>
Signed-off-by Sagi Grimberg <[email protected]>
Signed-off-by Jens Axboe <[email protected]>
--- drivers/nvme/host/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/nvme/host/core.c +3 -3
@@ -2057,9 +2057,9 @@ void nvme_kill_queues(struct nvme_ctrl *ctrl)* Revalidating a dead namespace sets capacity to 0. This will * end buffered writers dirtying pages that can't be synced. */ -if (ns->disk && !test_and_set_bit (NVME_NS_DEAD , &ns->flags)) -revalidate_disk (ns->disk); - +if (!ns->disk ||test_and_set_bit (NVME_NS_DEAD , &ns->flags)) +continue ; +revalidate_disk (ns->disk);blk_set_queue_dying (ns->queue);blk_mq_abort_requeue_list (ns->queue);blk_mq_start_stopped_hw_queues (ns->queue, true);
Signature · 1 line
2.5.5
PATCH 2/2 nvme/pci: Disable on removal when disconnected
commit 6db28eda266052f86a6b402422de61eeb7d2e351 upstream.
If the device is not present, the driver should disable the queues immediately. Prior to this, the driver was relying on the watchdog timer to kill the queues if requests were outstanding to the device, and that just delays removal up to one second.
Cc <[email protected]> # 4.9+
Signed-off-by Keith Busch <[email protected]>
Reviewed-by Johannes Thumshirn <[email protected]>
Reviewed-by Christoph Hellwig <[email protected]>
Signed-off-by Sagi Grimberg <[email protected]>
Signed-off-by Jens Axboe <[email protected]>
--- drivers/nvme/host/pci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/nvme/host/pci.c +3 -1
@@ -1983,8 +1983,10 @@ static void nvme_remove(struct pci_dev *pdev)pci_set_drvdata (pdev,NULL ); -if (!pci_device_is_present (pdev)) +if (!pci_device_is_present (pdev)) {nvme_change_ctrl_state (&dev->ctrl,NVME_CTRL_DEAD ); +nvme_dev_disable (dev, false); + }flush_work (&dev->reset_work);nvme_uninit_ctrl (&dev->ctrl);
Signature · 1 line
2.5.5