[PATCH 0/2] nvmet: fix FID 82h status codes for invalid NSIDs
Guixin Liu
kanie at linux.alibaba.com
Thu Sep 17 20:38:26 PDT 2026
The Reservation Notification Mask feature (FID 82h) defines its own
status code for NSIDs that do not name a namespace supporting
reservations:
"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
nvmet routes the namespace lookup of both handlers through
nvmet_req_find_ns(), which returns Invalid Namespace or Format for an
unknown NSID. That is the correct status for the generic
namespace-scoped admin commands, but not for this feature. A Set
Features 82h naming a nonexistent NSID, a Get Features 82h naming a
nonexistent NSID, and a Get Features 82h using the broadcast NSID are
all aborted with Invalid Namespace or Format instead of Invalid Field
in Command.
Each patch fixes one handler and translates the lookup failure to
Invalid Field in Command. The Set Features broadcast, the
namespace-without-reservations case, the disabled namespace path
(Internal Path Error, commit 505363957fad ("nvmet: fix nvme status
code when namespace is disabled")) and everything else keep their
current behavior.
Verified with two hosts (distinct host identifiers) connected over
NVMe/TCP to an nvmet subsystem exporting two reservation-enabled
null_blk namespaces: all three rejected cases now return 0x6002,
while Set/Get Features on an active namespace, the Set Features
broadcast and the reservation commands behave as before, with no
splat in dmesg.
Guixin Liu (2):
nvmet: return Invalid Field for invalid NSIDs in Set Features 82h
nvmet: return Invalid Field for invalid NSIDs in Get Features 82h
drivers/nvme/target/pr.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
--
2.43.7
More information about the Linux-nvme
mailing list