]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
zns: fix showing system error in report_zones
authorMinwoo Im <minwoo.im.dev@gmail.com>
Tue, 12 Jan 2021 14:37:06 +0000 (23:37 +0900)
committerKeith Busch <kbusch@kernel.org>
Tue, 12 Jan 2021 21:49:01 +0000 (14:49 -0700)
If nvme_zns_report_zones() returns system error(negative) value, it
should not be passed to nvme_show_status() which parses NVMe completion
status code in case of positive value from the ioctl.

Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
plugins/zns/zns.c

index 1287c97528173e314c971743fd950793092d4ebe..26b3f90d0ad69ddebc822412fc210d52db7b2113 100644 (file)
@@ -618,9 +618,12 @@ static int report_zones(int argc, char **argv, struct command *cmd, struct plugi
 
                err = nvme_zns_report_zones(fd, cfg.namespace_id, 0,
                        0, cfg.state, 0, sizeof(r), &r);
-               if (err) {
+               if (err > 0) {
                        nvme_show_status(err);
                        goto close_fd;
+               } else if (err < 0) {
+                       perror("zns report-zones");
+                       goto close_fd;
                }
                cfg.num_descs = le64_to_cpu(r.nr_zones);
        }