]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
nvme: Fix sync controller reset return
authorCharles Machalow <charles.machalow@intel.com>
Thu, 10 May 2018 23:01:38 +0000 (16:01 -0700)
committerKeith Busch <keith.busch@intel.com>
Fri, 11 May 2018 16:51:45 +0000 (10:51 -0600)
If a controller reset is requested while the device has no namespaces,
we were incorrectly returning ENETRESET. This patch adds the check for
ADMIN_ONLY controller state to indicate a successful reset.

Fixes: 8000d1fdb0 ("nvme-rdma: fix sysfs invoked reset_ctrl error flow ")
Cc: <stable@vger.kernel.org>
Signed-off-by: Charles Machalow <charles.machalow@intel.com>
[changelog]
Signed-off-by: Keith Busch <keith.busch@intel.com>
drivers/nvme/host/core.c

index 2cbc378bc0d619a1fdebc1fcee71d4abadb534fc..99b857e5a7a9c7dcde1e031eeab99f3737f026c3 100644 (file)
@@ -118,7 +118,8 @@ int nvme_reset_ctrl_sync(struct nvme_ctrl *ctrl)
        ret = nvme_reset_ctrl(ctrl);
        if (!ret) {
                flush_work(&ctrl->reset_work);
-               if (ctrl->state != NVME_CTRL_LIVE)
+               if (ctrl->state != NVME_CTRL_LIVE &&
+                   ctrl->state != NVME_CTRL_ADMIN_ONLY)
                        ret = -ENETRESET;
        }