Minwoo Im [Thu, 18 Nov 2021 13:20:12 +0000 (22:20 +0900)]
nvme-print: print generic device in list command
Generic namespace device is one of I/O paths that needs to be listed up
in the `nvme list` command along with the blkdev. Print it out in the
simple list command.
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Hannes Reinecke [Wed, 16 Mar 2022 14:32:06 +0000 (15:32 +0100)]
fabrics: check for discovery controller instead of subsystem NQN
Unique discovery subsystems have a unique subsystem NQN, to we cannot
check for the standard discovery NQN when checking for persistent
discovery controllers, but rather have to check if the subsystem is a
discovery subsystem.
Daniel Wagner [Wed, 16 Mar 2022 10:47:46 +0000 (11:47 +0100)]
nvmf-autoconnect: Add option to specify path to systemctl
Many distros have adapted the usr merge and hence systemctl is install
in /usr/bin. Instead just hard coding the new path, let's introduce a
new build option to allow specifying the path to the systemclt
binary.
Note, the scripts also have hard coded paths to /bin/sh or
/bin/echo. None of these paths are covered by POSIX but in practice
all distros have those as symlinks when the usr merge have been
implemented. Let's address these issues when the pop up.
Daniel Wagner [Tue, 15 Mar 2022 18:25:22 +0000 (19:25 +0100)]
fabrics: Honor sysconfdir for hostnqn and hostid files
When sysconfdir is set during build the hostnqn and hostid file should
be installed under this path. Replace the hard coded path and also
update the documentation.
Daniel Wagner [Tue, 15 Mar 2022 18:08:25 +0000 (19:08 +0100)]
build: Copy include adoc files to build dir
asciidoctor wants all file to live under one common directory root,
thus we can't provide a search path for the include files. Copy
include files to the build dir.
Tomas Bzatek [Tue, 15 Mar 2022 15:01:54 +0000 (16:01 +0100)]
plugins/memblaze: Code style fixes
clang complains, purely cosmetic change:
../plugins/memblaze/memblaze-nvme.c:1119:2: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
return err;
^
../plugins/memblaze/memblaze-nvme.c:1102:7: note: previous statement is here
} else if (err > 0)
^
Tomas Bzatek [Tue, 15 Mar 2022 14:50:42 +0000 (15:50 +0100)]
plugins/wdc: Fix a use-after-free
../plugins/wdc/wdc-nvme.c: In function ‘get_dev_mgment_cbs_data’:
../plugins/wdc/wdc-nvme.c:1714:31: warning: pointer ‘hdr_ptr’ used after ‘free’ [-Wuse-after-free]
1714 | data = calloc(le32_to_cpu(hdr_ptr->length), sizeof(__u8));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../plugins/wdc/wdc-nvme.c:1713:17: note: call to ‘free’ here
1713 | free(data);
| ^~~~~~~~~~
Tomas Bzatek [Mon, 14 Mar 2022 17:15:20 +0000 (18:15 +0100)]
connect: Set errno to zero on nvmf_add_ctrl() success
The libnvme's nvmf_add_ctrl() might return zero (success) while
having errno set to a non-zero value due to lots of calls inside.
And since nvmf_connect() returns errno primarily, make sure
it's zeroed on success.
See related https://github.com/linux-nvme/libnvme/pull/292
Daniel Wagner [Fri, 11 Mar 2022 16:46:46 +0000 (17:46 +0100)]
nvme: constify variable in list_subsys
The compiler complains with
../nvme.c: In function ‘list_subsys’:
../nvme.c:2478:19: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
2478 | n = strrchr(devicename, 'n');
| ^
devicename is of type 'const char *' so the returning pointer is of
the same type. Thus constify the n variable.
Daniel Wagner [Fri, 11 Mar 2022 16:30:08 +0000 (17:30 +0100)]
build: Enable docs build in update docs script
Commit 59263bbcd3e4 ("build: Use boolean type for docs-build default")
introduced a command line option to enable docs build. Let's enable
this in the update docs script.
Hannes Reinecke [Fri, 11 Mar 2022 08:16:09 +0000 (09:16 +0100)]
nvme: print out ANA state for 'list-subsys'
Commit 00aeb92 ("nvme-list-subsys: Add device name argument
and print out ANA state") was not properly ported to libnvme/nvme-cli.
So port the missing bits.
Daniel Wagner [Tue, 8 Mar 2022 14:32:25 +0000 (15:32 +0100)]
nvme: Explicit initialize all command line options
Sort the command line options like the appear on the command line.
Also tabilize and initialize all command options. The consistent
aligment of the options makes the reviewing simpler.
Steven Seungcheol Lee [Fri, 4 Mar 2022 07:05:32 +0000 (16:05 +0900)]
Add build_assert to fix debug build error
../ccan/ccan/str/str.h:169:10: fatal error: ccan/build_assert/build_assert.h: No such file or directory
169 | #include <ccan/build_assert/build_assert.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
Daniel Wagner [Tue, 1 Mar 2022 15:10:25 +0000 (16:10 +0100)]
nvme-cli: Ignore traddr case
There was is no requirement in the NVME-FC specification that traddr
needs to be upper or lower case. Given the case difference, the
connect-all fails the match logic. Switch to strcasecmp for a
case insensitive compare.
Based on 1264c6323937 ("nvme-cli: Make connect-all matching be case
insensitive")
Martin George [Tue, 1 Mar 2022 11:52:36 +0000 (17:22 +0530)]
nvme: fix segfault in nvme telemetry-log error handling
After the upgrade to libnvme, the nvme telemetry-log command
segfaults for error scenarios as shown below:
NVMe status: Invalid Log Page: The log page indicated is invalid(0x4009)
Failed to acquire telemetry log 16393!
Segmentation fault (core dumped)
Freeing the telemetry log page header for error scenarios is already
handled in the libnvme. So avoid freeing this again here, which led to
this segfault.
Daniel Wagner [Fri, 25 Feb 2022 12:57:05 +0000 (13:57 +0100)]
fabrics: ensure zero kato for non-persistent controllers
Add a helper function that sets the default kato value for the
discovery controllers. Along with ensuring a non-zero kato value
(i.e. NVMF_DEF_DISC_TMO) is passed to a persistent discovery
controller, it also ensures a zero kato value is passed to a
non-persistent discovery controller, as mandated by the NVMe spec.
Signed-off-by: Martin George <marting@netapp.com>
[dwagner: ported from monolithic branch] Signed-off-by: Daniel Wagner <dwagner@suse.de>
Daniel Wagner [Tue, 22 Feb 2022 09:21:29 +0000 (10:21 +0100)]
intel: Workaround initializer element is not constant
Older gcc do not like the constant initializer expression in the intel
plugin:
../plugins/intel/intel-nvme.c: In function ‘lat_stats_log_scale’:
../plugins/intel/intel-nvme.c:662:47: error: initializer element is not constant
static const int LATENCY_STATS_V4_BASE_VAL = (
Martin George [Mon, 21 Feb 2022 10:17:24 +0000 (15:47 +0530)]
nvme-print: fix 'nvme list -o json' segfault
After the recent upgrade to libnvme, 'nvme list -o json' segfaults
due to incorrect json object type passed here. So fix this by passing
the appropriate json object type and invoking it outside the
nvme_for_each_host loop.
Martin George [Mon, 21 Feb 2022 05:09:14 +0000 (10:39 +0530)]
nvme: get_ns_id command fails on nvme device
The get-ns-id command currently prints the perror status for a
given nvme device rather than its nsid. Fix this by properly
checking the return status of the nvme_get_nsid() function.