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.
Martin George [Wed, 16 Feb 2022 18:33:20 +0000 (00:03 +0530)]
netapp-nvme: fix nvme ns desc uuid handling for ontapdevices
The nvme ns desc uuid handling in the NetApp plugin for
ontapdevices is broken after the recent upgrade to libnvme. The
uuid hanlding logic here was flawed to begin with, so rework this
code to ensure the respective uuid descriptor itself is stored in
the ontapdevice_info structure and processed appropriately.
Jeff Lien [Mon, 14 Feb 2022 22:32:19 +0000 (16:32 -0600)]
wdc: Fix use-after-free access of cbs_data
Fix incorrect access after memory is already freed up. Also couple
of minor fixes to use correct cpu endianness while accessing data
read from drive.
Create a new function wdc_get_fw_cust_id that will simplfy the code
and handle the free of the allocated data
Signed-off-by: Jeff Lien <jeff.lien@wdc.com> Co-Authored-by: Indraneel-M
[dwagner: updated commit message and merged everything into one patch] Signed-off-by: Daniel Wagner <dwagner@suse.de>
Daniel Wagner [Tue, 15 Feb 2022 15:05:32 +0000 (16:05 +0100)]
nvme: Update help text for --force
The short flag version --force has been removed in 90592d5188fe ("nvme: Consolidate --force option and udpate
documetation") but the help text didn't get updated.
Daniel Wagner [Tue, 15 Feb 2022 15:00:53 +0000 (16:00 +0100)]
nvme: Open device exclusive for write command
Commit 2100609ddefb ("nvme: open namespace exclusive by default")
tried to make the write command a bit safer by asking to open the
device exclusive. Because the commit got reverted let's add the main
change back which is to use O_EXCL for write commands on default.
Daniel Wagner [Tue, 15 Feb 2022 14:26:37 +0000 (15:26 +0100)]
nvme: Only open device once
open_exclusive() takes care with opening the device. Do not open a
second time the device.
open_exclusive() has an overwrite flag. Document it a bit better by
renaming it what it actually means. The idea here is that the device
is openened with O_EXCL and when forced is used, open without this
flag.
Fix this by passing the appropriate json array type for
ontapdevices. Include a couple of minor changes here as well -
add a newline to the end of the json output, and then free the
json root device.
Daniel Wagner [Thu, 10 Feb 2022 16:57:01 +0000 (17:57 +0100)]
argconfig: Increase the flag value
If the flag is provided several time increase the flag value. This is
a pretty ugly fix for how getopt_long_only() handles '--verbose' vs
'-v'. getopt_long_only() returns 0 when --verbose is used and 'v' for
-v hence we will not usually not take the short option path for
--verbose.
Break out in the short option parsing when non flag options are used.
Another uglyliness here is that it sets up long options differently
depending on short or long version is used. For the short version we
have to use value_addr.
Daniel Wagner [Tue, 8 Feb 2022 11:13:34 +0000 (12:13 +0100)]
nvme: Fix --force flag inversion
argparse sets the default_value member when the argument has been
provided by the user. But in parse_and_open we set O_EXCL when --force
is not used.
It also introduced a regression in the 'id-ns' where the --force flag
is used to determine which function is used to identify the
namespace (nvme_identify_allocated_ns() vs nvme_identify_ns()).
Fixes: 2100609 ("nvme: open namespace exclusive by default") Signed-off-by: Daniel Wagner <dwagner@suse.de>
Daniel Wagner [Mon, 7 Feb 2022 14:13:40 +0000 (15:13 +0100)]
build: Make CI build fail on warnings.
Currently, warnings are hidden in the logs and the build is marked as
succeeded. Mark all warnings as error so that we see them show up in
the review process.
Steven Seungcheol Lee [Fri, 7 Jan 2022 09:37:06 +0000 (18:37 +0900)]
nvme: Add nvm-id-ns-lba-format(CNS 0Ah) command from TP4095
I/O Command Set specific Identify Namespace data structure
for the specified LBA Format index for the NVM Command Set
specified in the CSI field.
None capabilities from nvme_id_ns structure are returned as 0 with this command
Set maximum nlbaf when identify ns for all ns is failed to print elbafs
Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>