All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Guixin Liu <kanie@linux.alibaba.com>
Cc: Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@kernel.dk>,
	Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
	Nilay Shroff <nilay@linux.ibm.com>,
	Daniel Wagner <dwagner@suse.de>,
	John Garry <john.g.garry@oracle.com>,
	Hannes Reinecke <hare@suse.de>,
	linux-nvme@lists.infradead.org
Subject: Re: [PATCH 2/2] nvmet: return Invalid Field for invalid NSIDs in Get Features 82h
Date: Fri, 18 Sep 2026 14:05:45 +0200	[thread overview]
Message-ID: <20260918120545.GB16425@lst.de> (raw)
In-Reply-To: <20260918033932.3864965-3-kanie@linux.alibaba.com>

On Fri, Sep 18, 2026 at 11:39:32AM +0800, 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>
> ---
>  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;
> +	}

Same thing about the comment, and I guess a direct return would
also make this a tiny bit more readable.



      reply	other threads:[~2026-09-18 12:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-18  3:39 [PATCH 0/2] nvmet: fix FID 82h status codes for invalid NSIDs Guixin Liu
2026-09-18  3:39 ` [PATCH 1/2] nvmet: return Invalid Field for invalid NSIDs in Set Features 82h Guixin Liu
2026-09-18 12:05   ` Christoph Hellwig
2026-09-20  1:57     ` Guixin Liu
2026-09-18  3:39 ` [PATCH 2/2] nvmet: return Invalid Field for invalid NSIDs in Get " Guixin Liu
2026-09-18 12:05   ` Christoph Hellwig [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260918120545.GB16425@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=dwagner@suse.de \
    --cc=hare@suse.de \
    --cc=john.g.garry@oracle.com \
    --cc=kanie@linux.alibaba.com \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=nilay@linux.ibm.com \
    --cc=sagi@grimberg.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.