From: Nilay Shroff <nilay@linux.ibm.com>
To: linux-nvme@lists.infradead.org
Cc: hch@lst.de, sagi@grimberg.me, kch@nvidia.com, kbusch@kernel.org,
axboe@fb.com, gjoyce@linux.ibm.com,
"shinichiro.kawasaki@wdc.com" <shinichiro.kawasaki@wdc.com>,
Daniel Wagner <dwagner@suse.de>,
Martin Wilck <martin.wilck@suse.com>
Subject: Re: [PATCH] nvmet-passthru: allow nvme ns-id descriptor list to clear EUID/NGUID/UUID
Date: Wed, 18 Sep 2024 13:22:52 +0530 [thread overview]
Message-ID: <8b17203f-ea4b-403b-a204-4fbc00c261ca@linux.ibm.com> (raw)
In-Reply-To: <20240917085112.155173-1-nilay@linux.ibm.com>
On 9/17/24 14:21, Nilay Shroff wrote:
> When nvme passthru is configured using loop target, the clear_ids
> attribute is, by default, set to true. This attribute would ensure that
> EUID/NGUID/UUID is cleared for the loop passthru target.
>
> The newer NVMe disk supporting the NVMe spec 1.3 or higher, typically,
> implements the support for "Namespace Identification Descriptor list"
> command. This command when issued from host returns EUID/NGUID/UUID
> assigned to the inquired namespace. Not clearing these values, while
> using nvme passthru using loop target, would result in NVMe host driver
> rejecting the namespace. This check was implemented in the commit
> 2079f41ec6ff ("nvme: check that EUI/GUID/UUID are globally unique").
>
> The fix implemented in this commit ensure that when host issues ns-id
> descriptor list command, the EUID/NGUID/UUID are cleared by passthru
> target. In fact, the function nvmet_passthru_override_id_descs() which
> clears those unique ids already exits, so we just need to ensure that
> ns-id descriptor list command falls through the corretc code path. And
> while we're at it, we also combines the three passthru admin command
> cases together which shares the same code.
>
> Signed-off-by: Nilay Shroff <nilay@linux.ibm.com>
> ---
> drivers/nvme/target/passthru.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/nvme/target/passthru.c b/drivers/nvme/target/passthru.c
> index 24d0e2418d2e..d786d8dee131 100644
> --- a/drivers/nvme/target/passthru.c
> +++ b/drivers/nvme/target/passthru.c
> @@ -535,10 +535,6 @@ u16 nvmet_parse_passthru_admin_cmd(struct nvmet_req *req)
> break;
> case nvme_admin_identify:
> switch (req->cmd->identify.cns) {
> - case NVME_ID_CNS_CTRL:
> - req->execute = nvmet_passthru_execute_cmd;
> - req->p.use_workqueue = true;
> - return NVME_SC_SUCCESS;
> case NVME_ID_CNS_CS_CTRL:
> switch (req->cmd->identify.csi) {
> case NVME_CSI_ZNS:
> @@ -547,7 +543,11 @@ u16 nvmet_parse_passthru_admin_cmd(struct nvmet_req *req)
> return NVME_SC_SUCCESS;
> }
> return NVME_SC_INVALID_OPCODE | NVME_STATUS_DNR;
> + case NVME_ID_CNS_CTRL:
> + fallthrough;
> case NVME_ID_CNS_NS:
> + fallthrough;
> + case NVME_ID_CNS_NS_DESC_LIST:
> req->execute = nvmet_passthru_execute_cmd;
> req->p.use_workqueue = true;
> return NVME_SC_SUCCESS;
On a sidenote: This issue could be reproduced (where we find passthru target namespeace being
ignored on the host due to duplicate IDs) using blktest nvme/033. I have a system with NVMe disk
which supports NVMe spec 1.3. On this system, when I run this blktest I can always reproduce
this issue:
# nvme list -v
Subsystem Subsystem-NQN Controllers
---------------- ------------------------------------------------------------------------------------------------ ----------------
nvme-subsys0 nqn.1994-11.com.samsung:nvme:PM1735:2.5-inch:S6EUNA0R500358 nvme0
Device SN MN FR TxPort Asdress Slot Subsystem Namespaces
-------- -------------------- ---------------------------------------- -------- ------ -------------- ------ ------------ ----------------
nvme0 S6EUNA0R500358 1.6TB NVMe Gen4 U.2 SSD REV.SN49 pcie 0018:01:00.0 nvme-subsys0 nvme0n1
Device Generic NSID Usage Format Controllers
------------ ------------ ---------- -------------------------- ---------------- ----------------
/dev/nvme0n1 /dev/ng0n1 0x1 5.75 GB / 5.75 GB 4 KiB + 0 B nvme0
# nvme show-regs /dev/nvme0 -H
<snip>
version : 10300
NVMe specification 1.3
<snip>
# ./check tests/nvme/033
nvme/033 => nvme0n1 (tr=loop) (create and connect to an NVMeOF target with a passthru controller)
Here, the above blktest hangs indefinitely.
And the relevant kernel logs:
# dmesg
nvmet: creating nvm controller 1 for subsystem blktests-subsystem-1 for NQN nqn.2014-08.org.nvmexpress:uuid:0f01fb42-9f7f-4856-b0b3-51e60b8de349.
nvme nvme1: D3 entry latency set to 10 seconds
nvme nvme1: creating 32 I/O queues.
nvme nvme1: new ctrl: "blktests-subsystem-1"
nvme nvme1: Failed to configure AEN (cfg 300)
nvme nvme1: VID:144d model:1.6TB NVMe Gen4 U.2 SSD firmware:REV.SN49
nvme nvme1: ignoring nsid 1 because of duplicate IDs
I have another system using an NVMe disk supporting NVMe spec 1.2 and on this system, running
the above test would PASS.
Moreover, I think we should fix the blktest nvme/033 so that it would bail out
after some time instead of hanging indefinitely. Also we don't have an nvme-cli
command which supports ns-id descriptor list command. We may also want to add
support of this new command in nvme-cli?
Thanks,
--Nilay
next prev parent reply other threads:[~2024-09-18 7:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-17 8:51 [PATCH] nvmet-passthru: allow nvme ns-id descriptor list to clear EUID/NGUID/UUID Nilay Shroff
2024-09-18 7:52 ` Nilay Shroff [this message]
2024-09-18 12:10 ` Christoph Hellwig
2024-09-20 16:49 ` Keith Busch
2024-09-21 7:05 ` Nilay Shroff
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=8b17203f-ea4b-403b-a204-4fbc00c261ca@linux.ibm.com \
--to=nilay@linux.ibm.com \
--cc=axboe@fb.com \
--cc=dwagner@suse.de \
--cc=gjoyce@linux.ibm.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=kch@nvidia.com \
--cc=linux-nvme@lists.infradead.org \
--cc=martin.wilck@suse.com \
--cc=sagi@grimberg.me \
--cc=shinichiro.kawasaki@wdc.com \
/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.