From: Guixin Liu <kanie@linux.alibaba.com>
To: 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>, Hannes Reinecke <hare@suse.de>
Cc: linux-nvme@lists.infradead.org
Subject: [PATCH v2 1/5] nvme: mask the status before checking for Host Identifier Inconsistent
Date: Wed, 2 Dec 2026 19:58:52 +0800 [thread overview]
Message-ID: <20261202115856.2235187-2-kanie@linux.alibaba.com> (raw)
In-Reply-To: <20261202115856.2235187-1-kanie@linux.alibaba.com>
nvme_pr_resv_report() retries with the legacy data structure when the
controller returns Host Identifier Inconsistent, but compares the raw
status returned by nvme_execute_rq(). A controller that sets the DNR
bit on that status never matches, so the fallback never happens and
the reservation report fails against such controllers.
Mask the status with NVME_SCT_SC_MASK, like nvme_status_to_pr_err()
already does.
Fixes: 5fd96a4e15de8 ("nvme: Add pr_ops read_keys support")
Cc: stable@vger.kernel.org
Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
---
Reproduced in a QEMU/KVM guest with nvmet-tcp loopback. A TEST-ONLY
injection in the test target (not part of this patch) makes it reject
Extended Data Structure reservation reports with Host Identifier
Inconsistent | DNR, emulating a third-party controller, while accepting
the legacy structure.
Unpatched: nvme_pr_resv_report() compares the raw status, the DNR bit
prevents the match, and no legacy retry is sent (one resv_report, eds=1;
read-keys fails). Patched: the masked comparison matches, a second
resv_report with eds=0 is sent and read-keys succeeds.
Regression without the injection: EDS reservation report and read-keys
succeed directly.
drivers/nvme/host/pr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nvme/host/pr.c b/drivers/nvme/host/pr.c
index f5711702b16a..f0aebf890e07 100644
--- a/drivers/nvme/host/pr.c
+++ b/drivers/nvme/host/pr.c
@@ -219,7 +219,7 @@ static int nvme_pr_resv_report(struct block_device *bdev, void *data,
retry:
ret = __nvme_send_pr_command(bdev, cdw10, cdw11, nvme_cmd_resv_report,
data, data_len);
- if (ret == NVME_SC_HOST_ID_INCONSIST &&
+ if ((ret & NVME_SCT_SC_MASK) == NVME_SC_HOST_ID_INCONSIST &&
cdw11 == NVME_EXTENDED_DATA_STRUCT) {
cdw11 = 0;
*eds = false;
--
2.43.7
next prev parent reply other threads:[~2026-12-02 11:59 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 11:58 [PATCH v2 0/5] nvme: target and host fixes from a drivers/nvme audit Guixin Liu
2026-12-02 11:58 ` Guixin Liu [this message]
2026-12-03 8:05 ` [PATCH v2 1/5] nvme: mask the status before checking for Host Identifier Inconsistent Christoph Hellwig
2026-12-03 15:26 ` Nilay Shroff
2026-12-04 13:59 ` Hannes Reinecke
2026-12-02 11:58 ` [PATCH v2 2/5] nvmet: read CRTO from the capability register Guixin Liu
2026-12-03 8:05 ` Christoph Hellwig
2026-12-03 15:26 ` Nilay Shroff
2026-12-04 13:59 ` Hannes Reinecke
2026-12-02 11:58 ` [PATCH v2 3/5] nvmet: complete the passthru request after applying command effects Guixin Liu
2026-12-03 8:05 ` Christoph Hellwig
2026-12-03 15:26 ` Nilay Shroff
2026-12-04 14:00 ` Hannes Reinecke
2026-12-02 11:58 ` [PATCH v2 4/5] nvmet-auth: reject negotiation when the configured DH group is not offered Guixin Liu
2026-12-03 8:07 ` Christoph Hellwig
2026-12-04 14:01 ` Hannes Reinecke
2026-12-02 11:58 ` [PATCH v2 5/5] nvmet-auth: require a DH value when a DH group was negotiated Guixin Liu
2026-12-03 8:08 ` Christoph Hellwig
2026-12-04 14:02 ` Hannes Reinecke
2026-12-03 21:22 ` (subset) [PATCH v2 0/5] nvme: target and host fixes from a drivers/nvme audit Keith Busch
2026-12-04 15:36 ` Keith Busch
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=20261202115856.2235187-2-kanie@linux.alibaba.com \
--to=kanie@linux.alibaba.com \
--cc=axboe@kernel.dk \
--cc=dwagner@suse.de \
--cc=hare@suse.de \
--cc=hch@lst.de \
--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.