]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
nvme-pci: Sync queues on reset
authorKeith Busch <keith.busch@intel.com>
Tue, 14 May 2019 20:46:09 +0000 (14:46 -0600)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Tue, 2 Jul 2019 12:18:49 +0000 (14:18 +0200)
BugLink: https://bugs.launchpad.net/bugs/1808957
A controller with multiple namespaces may have multiple request_queues with
their own timeout work. If a controller fails with IO outstanding to
diffent namespaces, each request queue may attempt to handle it, so
ensure there is no previously scheduled timeout work executing prior to
starting controller initialization by synchronizing with each queue.

Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <keith.busch@intel.com>
(backported from commit d6135c3a1ec0cddda7b8b8e1b5b4abeeafd98289)
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Acked-by: Timo Aaltonen <tjaalton@ubuntu.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/nvme/host/core.c
drivers/nvme/host/nvme.h
drivers/nvme/host/pci.c

index 29978c7595872754c9179c159fbde1d114135a03..2602830eb9f461978c24c1d0ec0a74e10efcf2e9 100644 (file)
@@ -3474,6 +3474,17 @@ int nvme_reinit_tagset(struct nvme_ctrl *ctrl, struct blk_mq_tag_set *set)
 }
 EXPORT_SYMBOL_GPL(nvme_reinit_tagset);
 
+void nvme_sync_queues(struct nvme_ctrl *ctrl)
+{
+       struct nvme_ns *ns;
+
+       mutex_lock(&ctrl->namespaces_mutex);
+       list_for_each_entry(ns, &ctrl->namespaces, list)
+               blk_sync_queue(ns->queue);
+       mutex_unlock(&ctrl->namespaces_mutex);
+}
+EXPORT_SYMBOL_GPL(nvme_sync_queues);
+
 int __init nvme_core_init(void)
 {
        int result;
index 70d8c1d6182604314ff11a46b5c5f3294c45f922..e31702af458981a62a409781f87c45f0634f6ff5 100644 (file)
@@ -382,6 +382,7 @@ void nvme_complete_async_event(struct nvme_ctrl *ctrl, __le16 status,
 void nvme_stop_queues(struct nvme_ctrl *ctrl);
 void nvme_start_queues(struct nvme_ctrl *ctrl);
 void nvme_kill_queues(struct nvme_ctrl *ctrl);
+void nvme_sync_queues(struct nvme_ctrl *ctrl);
 void nvme_unfreeze(struct nvme_ctrl *ctrl);
 void nvme_wait_freeze(struct nvme_ctrl *ctrl);
 void nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout);
index fed64c35814de6ea1672ee18f7c0e4924594f9bf..c108e603c66c0696d02f80f11185f8608ce68a73 100644 (file)
@@ -2327,6 +2327,7 @@ static void nvme_reset_work(struct work_struct *work)
         */
        if (dev->ctrl.ctrl_config & NVME_CC_ENABLE)
                nvme_dev_disable(dev, false);
+       nvme_sync_queues(&dev->ctrl);
 
        result = nvme_pci_enable(dev);
        if (result)