]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme-cli/list-ns: fix identifying active or allocated namespaces list
authorGuan Junxiong <guanjunxiong@huawei.com>
Mon, 10 Jul 2017 07:56:07 +0000 (15:56 +0800)
committerKeith Busch <keith.busch@intel.com>
Mon, 10 Jul 2017 16:46:32 +0000 (12:46 -0400)
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

index f5cbc288a5031e43b7e87f003d9648555a6cbecb..f49f1c0235f84b2695216212f611af1ca38b82d2 100644 (file)
@@ -353,7 +353,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);
 }