[PATCH 4.16 62/72] nvme: Fix sync controller reset return
From: Greg Kroah-Hartman
Date: Mon May 14 2018 - 03:00:33 EST
4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Machalow <charles.machalow@xxxxxxxxx>
commit 4e50d9ebaeaa3c6761d2b513ef7039510c8cf213 upstream.
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@xxxxxxxxxxxxxxx>
Signed-off-by: Charles Machalow <charles.machalow@xxxxxxxxx>
[changelog]
Signed-off-by: Keith Busch <keith.busch@xxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
drivers/nvme/host/core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -122,7 +122,8 @@ int nvme_reset_ctrl_sync(struct nvme_ctr
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;
}