[PATCH] nvmet: return 'namespace not ready' for disabled namespaces

Hannes Reinecke hare at kernel.org
Mon Aug 19 05:29:17 PDT 2024


When a namespace is disabled from configfs returning 'path error'
is quite an odd choice; the actual description for that error is:
'The command was not completed as a result of a controller internal
error that is specific to the controller processing the command.'
Which is not the case here; once disabled the namespace is disabled
for the entire subsystem, not just the controller.
So return 'namespace not ready' here to clarify the problem.

Signed-off-by: Hannes Reinecke <hare at kernel.org>
---
 drivers/nvme/target/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index ed2424f8a396..d9ce1326f4ab 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -444,7 +444,7 @@ u16 nvmet_req_find_ns(struct nvmet_req *req)
 	if (unlikely(!req->ns)) {
 		req->error_loc = offsetof(struct nvme_common_command, nsid);
 		if (nvmet_subsys_nsid_exists(subsys, nsid))
-			return NVME_SC_INTERNAL_PATH_ERROR;
+			return NVME_SC_NS_NOT_READY;
 		return NVME_SC_INVALID_NS | NVME_STATUS_DNR;
 	}
 
-- 
2.35.3




More information about the Linux-nvme mailing list