From: Guan Junxiong Date: Mon, 10 Jul 2017 07:56:07 +0000 (+0800) Subject: nvme-cli/list-ns: fix identifying active or allocated namespaces list X-Git-Tag: v1.4~23 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=390bdcbec7373c5b7057bff056ec73e608a19d1f;p=users%2Fsagi%2Fnvme-cli.git nvme-cli/list-ns: fix identifying active or allocated namespaces list 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 Reviewed-by: Sagi Grimberg Signed-off-by: Keith Busch --- diff --git a/nvme-ioctl.c b/nvme-ioctl.c index f5cbc288..f49f1c02 100644 --- a/nvme-ioctl.c +++ b/nvme-ioctl.c @@ -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); }