[PATCH 2/2] nvmet: return Invalid Field for invalid NSIDs in Get Features 82h
Guixin Liu
kanie at linux.alibaba.com
Thu Sep 17 20:39:32 PDT 2026
The Reservation Notification Mask feature (FID 82h) rejects the same
NSIDs for Get Features as for Set Features, plus the broadcast NSID:
"A Get Features command that uses a namespace ID of FFFFFFFFh
shall be aborted with status code of Invalid Field in Command.
If a Set Features command or a Get Features command attempts to
access the Reservation Notification Mask on a namespace that does
not support reservations or is invalid, then that command is
aborted with status code of Invalid Field in Command."
-- NVMe Base Specification, section 5.2.26.1.33
The Get Features handler routes the namespace lookup through
nvmet_req_find_ns(), which returns Invalid Namespace or Format for an
unknown NSID. Both rejected cases land there: a nonexistent NSID
fails the lookup, and so does the broadcast NSID, which never names a
namespace. Both are aborted with Invalid Namespace or Format instead
of Invalid Field in Command.
Translate the lookup failure to Invalid Field in Command, as was done
for Set Features.
Fixes: 5a47c2080a73 ("nvmet: support reservation feature")
Signed-off-by: Guixin Liu <kanie at linux.alibaba.com>
---
drivers/nvme/target/pr.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/target/pr.c b/drivers/nvme/target/pr.c
index 927e3c44952b..8762ef64aa46 100644
--- a/drivers/nvme/target/pr.c
+++ b/drivers/nvme/target/pr.c
@@ -79,8 +79,12 @@ u16 nvmet_get_feat_resv_notif_mask(struct nvmet_req *req)
u16 status;
status = nvmet_req_find_ns(req);
- if (status)
+ if (status) {
+ /* 82h is Invalid Field for invalid and broadcast NSIDs */
+ if (status == (NVME_SC_INVALID_NS | NVME_STATUS_DNR))
+ status = NVME_SC_INVALID_FIELD | NVME_STATUS_DNR;
return status;
+ }
if (!req->ns->pr.enable)
return NVME_SC_INVALID_FIELD | NVME_STATUS_DNR;
--
2.43.7
More information about the Linux-nvme
mailing list