Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] nvmet: fix FID 82h status codes for invalid NSIDs
@ 2026-09-20  3:34 Guixin Liu
  2026-09-20  3:34 ` [PATCH v2 1/2] nvmet: return Invalid Field for invalid NSIDs in Set Features 82h Guixin Liu
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Guixin Liu @ 2026-09-20  3:34 UTC (permalink / raw)
  To: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
	Nilay Shroff, Daniel Wagner, John Garry, Hannes Reinecke
  Cc: linux-nvme

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.

Changes since v1:

 - drop the comments above the status translation.(Christoph Hellwig)
 - return Invalid Field in Command directly instead of assigning it
   to status first, which also removes the braces and the overly long
   (Christoph Hellwig)

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 | 4 ++++
 1 file changed, 4 insertions(+)

-- 
2.43.7



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2 1/2] nvmet: return Invalid Field for invalid NSIDs in Set Features 82h
  2026-09-20  3:34 [PATCH v2 0/2] nvmet: fix FID 82h status codes for invalid NSIDs Guixin Liu
@ 2026-09-20  3:34 ` Guixin Liu
  2026-09-20 11:07   ` Nilay Shroff
                     ` (2 more replies)
  2026-09-20  3:35 ` [PATCH v2 2/2] nvmet: return Invalid Field for invalid NSIDs in Get " Guixin Liu
  2026-10-03  8:54 ` [PATCH v2 0/2] nvmet: fix FID 82h status codes for invalid NSIDs Keith Busch
  2 siblings, 3 replies; 12+ messages in thread
From: Guixin Liu @ 2026-09-20  3:34 UTC (permalink / raw)
  To: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
	Nilay Shroff, Daniel Wagner, John Garry, Hannes Reinecke
  Cc: linux-nvme

The Reservation Notification Mask feature (FID 82h) defines its own
status code for namespaces that do not support reservations:

  "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 Set Features handler routes the namespace lookup 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 is aborted with Invalid
Namespace or Format instead of Invalid Field in Command.

Translate the lookup failure to Invalid Field in Command.  The
broadcast NSID, the namespace-without-reservations case and everything
else keep their current behavior.

Fixes: 5a47c2080a73 ("nvmet: support reservation feature")
Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
---
 drivers/nvme/target/pr.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/nvme/target/pr.c b/drivers/nvme/target/pr.c
index 0948a690a1c0..a36c732883d4 100644
--- a/drivers/nvme/target/pr.c
+++ b/drivers/nvme/target/pr.c
@@ -51,6 +51,8 @@ u16 nvmet_set_feat_resv_notif_mask(struct nvmet_req *req, u32 mask)
 
 	if (nsid != U32_MAX) {
 		status = nvmet_req_find_ns(req);
+		if (status == (NVME_SC_INVALID_NS | NVME_STATUS_DNR))
+			return NVME_SC_INVALID_FIELD | NVME_STATUS_DNR;
 		if (status)
 			return status;
 		if (!req->ns->pr.enable)
-- 
2.43.7



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 2/2] nvmet: return Invalid Field for invalid NSIDs in Get Features 82h
  2026-09-20  3:34 [PATCH v2 0/2] nvmet: fix FID 82h status codes for invalid NSIDs Guixin Liu
  2026-09-20  3:34 ` [PATCH v2 1/2] nvmet: return Invalid Field for invalid NSIDs in Set Features 82h Guixin Liu
@ 2026-09-20  3:35 ` Guixin Liu
  2026-09-25  7:32   ` Christoph Hellwig
  2026-09-25 11:24   ` Nilay Shroff
  2026-10-03  8:54 ` [PATCH v2 0/2] nvmet: fix FID 82h status codes for invalid NSIDs Keith Busch
  2 siblings, 2 replies; 12+ messages in thread
From: Guixin Liu @ 2026-09-20  3:35 UTC (permalink / raw)
  To: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
	Nilay Shroff, Daniel Wagner, John Garry, Hannes Reinecke
  Cc: linux-nvme

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@linux.alibaba.com>
---
 drivers/nvme/target/pr.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/nvme/target/pr.c b/drivers/nvme/target/pr.c
index a36c732883d4..62ef8e85f7e9 100644
--- a/drivers/nvme/target/pr.c
+++ b/drivers/nvme/target/pr.c
@@ -77,6 +77,8 @@ u16 nvmet_get_feat_resv_notif_mask(struct nvmet_req *req)
 	u16 status;
 
 	status = nvmet_req_find_ns(req);
+	if (status == (NVME_SC_INVALID_NS | NVME_STATUS_DNR))
+		return NVME_SC_INVALID_FIELD | NVME_STATUS_DNR;
 	if (status)
 		return status;
 
-- 
2.43.7



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 1/2] nvmet: return Invalid Field for invalid NSIDs in Set Features 82h
  2026-09-20  3:34 ` [PATCH v2 1/2] nvmet: return Invalid Field for invalid NSIDs in Set Features 82h Guixin Liu
@ 2026-09-20 11:07   ` Nilay Shroff
  2026-09-21  6:53     ` Christoph Hellwig
  2026-09-25  7:31   ` Christoph Hellwig
  2026-09-25 11:24   ` Nilay Shroff
  2 siblings, 1 reply; 12+ messages in thread
From: Nilay Shroff @ 2026-09-20 11:07 UTC (permalink / raw)
  To: Guixin Liu, Keith Busch, Jens Axboe, Christoph Hellwig,
	Sagi Grimberg, Daniel Wagner, John Garry, Hannes Reinecke
  Cc: linux-nvme

On 9/20/26 9:04 AM, Guixin Liu wrote:
> diff --git a/drivers/nvme/target/pr.c b/drivers/nvme/target/pr.c
> index 0948a690a1c0..a36c732883d4 100644
> --- a/drivers/nvme/target/pr.c
> +++ b/drivers/nvme/target/pr.c
> @@ -51,6 +51,8 @@ u16 nvmet_set_feat_resv_notif_mask(struct nvmet_req *req, u32 mask)
>   
>   	if (nsid != U32_MAX) {
>   		status = nvmet_req_find_ns(req);
> +		if (status == (NVME_SC_INVALID_NS | NVME_STATUS_DNR))
> +			return NVME_SC_INVALID_FIELD | NVME_STATUS_DNR;
>   		if (status)
>   			return status;
>   		if (!req->ns->pr.enable)
> -- 

This looks good to me. However, to avoid hand-coding the same error
return code multiple times in the function and to make it a bit more
readable, how about modifying it as follows?

u16 nvmet_get_feat_resv_notif_mask(struct nvmet_req *req)
{
	u16 status;
	u16 err = NVME_SC_INVALID_FIELD | NVME_STATUS_DNR;

	status = nvmet_req_find_ns(req);
	if (status) {
		if (status == (NVME_SC_INVALID_NS | NVME_STATUS_DNR))
			return err;
		return status;
	}

	if (!req->ns->pr.enable)
		return err;

	nvmet_set_result(req, READ_ONCE(req->ns->pr.notify_mask));
	return NVME_SC_SUCCESS;
}

Thanks,
--Nilay



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 1/2] nvmet: return Invalid Field for invalid NSIDs in Set Features 82h
  2026-09-20 11:07   ` Nilay Shroff
@ 2026-09-21  6:53     ` Christoph Hellwig
  2026-09-21  7:56       ` Guixin Liu
  2026-09-21  8:24       ` Nilay Shroff
  0 siblings, 2 replies; 12+ messages in thread
From: Christoph Hellwig @ 2026-09-21  6:53 UTC (permalink / raw)
  To: Nilay Shroff
  Cc: Guixin Liu, Keith Busch, Jens Axboe, Christoph Hellwig,
	Sagi Grimberg, Daniel Wagner, John Garry, Hannes Reinecke,
	linux-nvme

On Sun, Sep 20, 2026 at 04:37:08PM +0530, Nilay Shroff wrote:
> On 9/20/26 9:04 AM, Guixin Liu wrote:
>> diff --git a/drivers/nvme/target/pr.c b/drivers/nvme/target/pr.c
>> index 0948a690a1c0..a36c732883d4 100644
>> --- a/drivers/nvme/target/pr.c
>> +++ b/drivers/nvme/target/pr.c
>> @@ -51,6 +51,8 @@ u16 nvmet_set_feat_resv_notif_mask(struct nvmet_req *req, u32 mask)
>>     	if (nsid != U32_MAX) {
>>   		status = nvmet_req_find_ns(req);
>> +		if (status == (NVME_SC_INVALID_NS | NVME_STATUS_DNR))
>> +			return NVME_SC_INVALID_FIELD | NVME_STATUS_DNR;
>>   		if (status)
>>   			return status;
>>   		if (!req->ns->pr.enable)
>> -- 
>
> This looks good to me. However, to avoid hand-coding the same error
> return code multiple times in the function and to make it a bit more
> readable, how about modifying it as follows?

I don't understand how that helps.  If we really want to refactor,
we could add a version of nvmet_req_find_ns that does it, but
that feels like a bit of overkill.

> 		if (status == (NVME_SC_INVALID_NS | NVME_STATUS_DNR))

Still no need for the inner braces here in all versions.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 1/2] nvmet: return Invalid Field for invalid NSIDs in Set Features 82h
  2026-09-21  6:53     ` Christoph Hellwig
@ 2026-09-21  7:56       ` Guixin Liu
  2026-09-21  8:24       ` Nilay Shroff
  1 sibling, 0 replies; 12+ messages in thread
From: Guixin Liu @ 2026-09-21  7:56 UTC (permalink / raw)
  To: Christoph Hellwig, Nilay Shroff
  Cc: Keith Busch, Jens Axboe, Sagi Grimberg, Daniel Wagner, John Garry,
	Hannes Reinecke, linux-nvme



在 2026/9/21 14:53, Christoph Hellwig 写道:
> On Sun, Sep 20, 2026 at 04:37:08PM +0530, Nilay Shroff wrote:
>> On 9/20/26 9:04 AM, Guixin Liu wrote:
>>> diff --git a/drivers/nvme/target/pr.c b/drivers/nvme/target/pr.c
>>> index 0948a690a1c0..a36c732883d4 100644
>>> --- a/drivers/nvme/target/pr.c
>>> +++ b/drivers/nvme/target/pr.c
>>> @@ -51,6 +51,8 @@ u16 nvmet_set_feat_resv_notif_mask(struct nvmet_req *req, u32 mask)
>>>     	if (nsid != U32_MAX) {
>>>   		status = nvmet_req_find_ns(req);
>>> +		if (status == (NVME_SC_INVALID_NS | NVME_STATUS_DNR))
>>> +			return NVME_SC_INVALID_FIELD | NVME_STATUS_DNR;
>>>   		if (status)
>>>   			return status;
>>>   		if (!req->ns->pr.enable)
>>> -- 
>> This looks good to me. However, to avoid hand-coding the same error
>> return code multiple times in the function and to make it a bit more
>> readable, how about modifying it as follows?
> I don't understand how that helps.  If we really want to refactor,
> we could add a version of nvmet_req_find_ns that does it, but
> that feels like a bit of overkill.
Agree.
>
>> 		if (status == (NVME_SC_INVALID_NS | NVME_STATUS_DNR))
> Still no need for the inner braces here in all versions.
Well, in C, the "==" operator has higher precedence than "|",
so the inner braces are required here.

Best Regards,
Guixin Liu



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 1/2] nvmet: return Invalid Field for invalid NSIDs in Set Features 82h
  2026-09-21  6:53     ` Christoph Hellwig
  2026-09-21  7:56       ` Guixin Liu
@ 2026-09-21  8:24       ` Nilay Shroff
  1 sibling, 0 replies; 12+ messages in thread
From: Nilay Shroff @ 2026-09-21  8:24 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Guixin Liu, Keith Busch, Jens Axboe, Sagi Grimberg, Daniel Wagner,
	John Garry, Hannes Reinecke, linux-nvme

On 9/21/26 12:23 PM, Christoph Hellwig wrote:
> On Sun, Sep 20, 2026 at 04:37:08PM +0530, Nilay Shroff wrote:
>> On 9/20/26 9:04 AM, Guixin Liu wrote:
>>> diff --git a/drivers/nvme/target/pr.c b/drivers/nvme/target/pr.c
>>> index 0948a690a1c0..a36c732883d4 100644
>>> --- a/drivers/nvme/target/pr.c
>>> +++ b/drivers/nvme/target/pr.c
>>> @@ -51,6 +51,8 @@ u16 nvmet_set_feat_resv_notif_mask(struct nvmet_req *req, u32 mask)
>>>      	if (nsid != U32_MAX) {
>>>    		status = nvmet_req_find_ns(req);
>>> +		if (status == (NVME_SC_INVALID_NS | NVME_STATUS_DNR))
>>> +			return NVME_SC_INVALID_FIELD | NVME_STATUS_DNR;
>>>    		if (status)
>>>    			return status;
>>>    		if (!req->ns->pr.enable)
>>> -- 
>>
>> This looks good to me. However, to avoid hand-coding the same error
>> return code multiple times in the function and to make it a bit more
>> readable, how about modifying it as follows?
> 
> I don't understand how that helps.  If we really want to refactor,
> we could add a version of nvmet_req_find_ns that does it, but
> that feels like a bit of overkill.
> 
I agree that adding a separate helper just for this would be unnecessary.

My suggestion was mainly for readability and to avoid repeating the same
NVME_SC_INVALID_FIELD | NVME_STATUS_DNR error code and keep the error
handling in one place. I also found the two status checks a little
less straightforward to read. When applying the proposed patch, the
resulting code looks like below:

u16 nvmet_get_feat_resv_notif_mask(struct nvmet_req *req)
{
	u16 status;

	status = nvmet_req_find_ns(req);
	if (status == (NVME_SC_INVALID_NS | NVME_STATUS_DNR))
		return NVME_SC_INVALID_FIELD | NVME_STATUS_DNR;
	if (status)
		return status;

	if (!req->ns->pr.enable)
		return NVME_SC_INVALID_FIELD | NVME_STATUS_DNR;

	nvmet_set_result(req, READ_ONCE(req->ns->pr.notify_mask));
	return status;
}

That said, this is mostly a matter of personal preference rather than
a functional concern, so I'm fine with keeping the current version if
everyone agrees.

>> 		if (status == (NVME_SC_INVALID_NS | NVME_STATUS_DNR))
> 
> Still no need for the inner braces here in all versions.
> 
I think Guixin has already replied to this comment in another
email. The inner braces are required here otherwise compiler
would complain:

drivers/nvme/target/pr.c:80:35: error: | has lower precedence than ==; == will be evaluated first [-Werror,-Wparentheses]
    80 |         if (status == NVME_SC_INVALID_NS | NVME_STATUS_DNR)
       |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^


Thanks,
--Nilay



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 1/2] nvmet: return Invalid Field for invalid NSIDs in Set Features 82h
  2026-09-20  3:34 ` [PATCH v2 1/2] nvmet: return Invalid Field for invalid NSIDs in Set Features 82h Guixin Liu
  2026-09-20 11:07   ` Nilay Shroff
@ 2026-09-25  7:31   ` Christoph Hellwig
  2026-09-25 11:24   ` Nilay Shroff
  2 siblings, 0 replies; 12+ messages in thread
From: Christoph Hellwig @ 2026-09-25  7:31 UTC (permalink / raw)
  To: Guixin Liu
  Cc: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
	Nilay Shroff, Daniel Wagner, John Garry, Hannes Reinecke,
	linux-nvme

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 2/2] nvmet: return Invalid Field for invalid NSIDs in Get Features 82h
  2026-09-20  3:35 ` [PATCH v2 2/2] nvmet: return Invalid Field for invalid NSIDs in Get " Guixin Liu
@ 2026-09-25  7:32   ` Christoph Hellwig
  2026-09-25 11:24   ` Nilay Shroff
  1 sibling, 0 replies; 12+ messages in thread
From: Christoph Hellwig @ 2026-09-25  7:32 UTC (permalink / raw)
  To: Guixin Liu
  Cc: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
	Nilay Shroff, Daniel Wagner, John Garry, Hannes Reinecke,
	linux-nvme

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 1/2] nvmet: return Invalid Field for invalid NSIDs in Set Features 82h
  2026-09-20  3:34 ` [PATCH v2 1/2] nvmet: return Invalid Field for invalid NSIDs in Set Features 82h Guixin Liu
  2026-09-20 11:07   ` Nilay Shroff
  2026-09-25  7:31   ` Christoph Hellwig
@ 2026-09-25 11:24   ` Nilay Shroff
  2 siblings, 0 replies; 12+ messages in thread
From: Nilay Shroff @ 2026-09-25 11:24 UTC (permalink / raw)
  To: Guixin Liu, Keith Busch, Jens Axboe, Christoph Hellwig,
	Sagi Grimberg, Daniel Wagner, John Garry, Hannes Reinecke
  Cc: linux-nvme

On 9/20/26 9:04 AM, Guixin Liu wrote:
> The Reservation Notification Mask feature (FID 82h) defines its own
> status code for namespaces that do not support reservations:
> 
>    "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 Set Features handler routes the namespace lookup 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 is aborted with Invalid
> Namespace or Format instead of Invalid Field in Command.
> 
> Translate the lookup failure to Invalid Field in Command.  The
> broadcast NSID, the namespace-without-reservations case and everything
> else keep their current behavior.
> 
> Fixes: 5a47c2080a73 ("nvmet: support reservation feature")
> Signed-off-by: Guixin Liu<kanie@linux.alibaba.com>

Looks good to me.

Reviewed-by: Nilay Shroff <nilay@linux.ibm.com>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 2/2] nvmet: return Invalid Field for invalid NSIDs in Get Features 82h
  2026-09-20  3:35 ` [PATCH v2 2/2] nvmet: return Invalid Field for invalid NSIDs in Get " Guixin Liu
  2026-09-25  7:32   ` Christoph Hellwig
@ 2026-09-25 11:24   ` Nilay Shroff
  1 sibling, 0 replies; 12+ messages in thread
From: Nilay Shroff @ 2026-09-25 11:24 UTC (permalink / raw)
  To: Guixin Liu, Keith Busch, Jens Axboe, Christoph Hellwig,
	Sagi Grimberg, Daniel Wagner, John Garry, Hannes Reinecke
  Cc: linux-nvme

On 9/20/26 9:05 AM, Guixin Liu wrote:
> 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@linux.alibaba.com>


Looks good to me.

Reviewed-by: Nilay Shroff <nilay@linux.ibm.com>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 0/2] nvmet: fix FID 82h status codes for invalid NSIDs
  2026-09-20  3:34 [PATCH v2 0/2] nvmet: fix FID 82h status codes for invalid NSIDs Guixin Liu
  2026-09-20  3:34 ` [PATCH v2 1/2] nvmet: return Invalid Field for invalid NSIDs in Set Features 82h Guixin Liu
  2026-09-20  3:35 ` [PATCH v2 2/2] nvmet: return Invalid Field for invalid NSIDs in Get " Guixin Liu
@ 2026-10-03  8:54 ` Keith Busch
  2 siblings, 0 replies; 12+ messages in thread
From: Keith Busch @ 2026-10-03  8:54 UTC (permalink / raw)
  To: Guixin Liu
  Cc: Jens Axboe, Christoph Hellwig, Sagi Grimberg, Nilay Shroff,
	Daniel Wagner, John Garry, Hannes Reinecke, linux-nvme

On Sun, Sep 20, 2026 at 11:34:58AM +0800, Guixin Liu wrote:
> 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.

Thanks, applied to nvme-7.3.


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-10-03  8:54 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-20  3:34 [PATCH v2 0/2] nvmet: fix FID 82h status codes for invalid NSIDs Guixin Liu
2026-09-20  3:34 ` [PATCH v2 1/2] nvmet: return Invalid Field for invalid NSIDs in Set Features 82h Guixin Liu
2026-09-20 11:07   ` Nilay Shroff
2026-09-21  6:53     ` Christoph Hellwig
2026-09-21  7:56       ` Guixin Liu
2026-09-21  8:24       ` Nilay Shroff
2026-09-25  7:31   ` Christoph Hellwig
2026-09-25 11:24   ` Nilay Shroff
2026-09-20  3:35 ` [PATCH v2 2/2] nvmet: return Invalid Field for invalid NSIDs in Get " Guixin Liu
2026-09-25  7:32   ` Christoph Hellwig
2026-09-25 11:24   ` Nilay Shroff
2026-10-03  8:54 ` [PATCH v2 0/2] nvmet: fix FID 82h status codes for invalid NSIDs Keith Busch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox