Skip to content

Commit e38dad4

Browse files
shroffnikeithbusch
authored andcommitted
nvmet-passthru: clear EUID/NGUID/UUID while using loop target
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 2079f41 ("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. Reviewed-by: Chaitanya Kulkarni <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Nilay Shroff <[email protected]> Signed-off-by: Keith Busch <[email protected]>
1 parent 8be007c commit e38dad4

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/nvme/target/passthru.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -535,10 +535,6 @@ u16 nvmet_parse_passthru_admin_cmd(struct nvmet_req *req)
535535
break;
536536
case nvme_admin_identify:
537537
switch (req->cmd->identify.cns) {
538-
case NVME_ID_CNS_CTRL:
539-
req->execute = nvmet_passthru_execute_cmd;
540-
req->p.use_workqueue = true;
541-
return NVME_SC_SUCCESS;
542538
case NVME_ID_CNS_CS_CTRL:
543539
switch (req->cmd->identify.csi) {
544540
case NVME_CSI_ZNS:
@@ -547,7 +543,9 @@ u16 nvmet_parse_passthru_admin_cmd(struct nvmet_req *req)
547543
return NVME_SC_SUCCESS;
548544
}
549545
return NVME_SC_INVALID_OPCODE | NVME_STATUS_DNR;
546+
case NVME_ID_CNS_CTRL:
550547
case NVME_ID_CNS_NS:
548+
case NVME_ID_CNS_NS_DESC_LIST:
551549
req->execute = nvmet_passthru_execute_cmd;
552550
req->p.use_workqueue = true;
553551
return NVME_SC_SUCCESS;

0 commit comments

Comments
 (0)