File 0014-nvme-cli-list-ns-fix-identifying-active-or.patch of Package nvme-cli.10193
From 6d81ae95c60a616de7d93a061d63009fe77fbf47 Mon Sep 17 00:00:00 2001
From: Guan Junxiong <guanjunxiong@huawei.com>
Date: Mon, 10 Jul 2017 15:56:07 +0800
Subject: nvme-cli/list-ns: fix identifying active or allocated namespaces list
Git-commit: 390bdcbec7373c5b7057bff056ec73e608a19d1f
References: bsc#1076113
The logic of the CNS field of identify namespace list is wrong.
For example, nvme list-ns /dev/nvme0 -n 0 should return active
namespaces list starting with id 1 (including), but currently this
script command returns INVALID_OPCODE if the target doesn't support
listing allocated namespaces or all the allocated attached namespaces
id. So fix it by swaping the CNS flags of active and allocated list.
Signed-off-by: Guan Junxiong <guanjunxiong@huawei.com>
Reviewed-by: Sagi Grimberg <sagi at grimberg.me>
Signed-off-by: Keith Busch <keith.busch@intel.com>
---
nvme-ioctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/nvme-ioctl.c b/nvme-ioctl.c
index e3e9af4..613b89a 100644
--- a/nvme-ioctl.c
+++ b/nvme-ioctl.c
@@ -352,7 +352,7 @@ int nvme_identify_ns(int fd, __u32 nsid, bool present, void *data)
int nvme_identify_ns_list(int fd, __u32 nsid, bool all, void *data)
{
- int cns = all ? NVME_ID_CNS_NS_ACTIVE_LIST : NVME_ID_CNS_NS_PRESENT_LIST;
+ int cns = all ? NVME_ID_CNS_NS_PRESENT_LIST : NVME_ID_CNS_NS_ACTIVE_LIST;
return nvme_identify(fd, nsid, cns, data);
}
--
2.13.7