diff options
author | Charles Machalow <charles.machalow@intel.com> | 2018-05-11 01:01:38 +0200 |
---|---|---|
committer | Keith Busch <keith.busch@intel.com> | 2018-05-11 18:51:45 +0200 |
commit | 4e50d9ebaeaa3c6761d2b513ef7039510c8cf213 (patch) | |
tree | 34f53556f597922875004c500b741de5a10400c1 | |
parent | nvme: fix use-after-free in nvme_free_ns_head (diff) | |
download | linux-4e50d9ebaeaa3c6761d2b513ef7039510c8cf213.tar.xz linux-4e50d9ebaeaa3c6761d2b513ef7039510c8cf213.zip |
nvme: Fix sync controller reset return
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>
-rw-r--r-- | drivers/nvme/host/core.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 2cbc378bc0d6..99b857e5a7a9 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -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; } |