Keith Busch [Thu, 10 Oct 2019 19:35:56 +0000 (04:35 +0900)]
fix namespace checks for legacy list
First ensure the controller we're comparing with has been initialized, and then
compare the correct fields with each other. Previously had been comparing a
model number against the serial.
Ben Reese [Tue, 8 Oct 2019 19:24:34 +0000 (12:24 -0700)]
Intel plugin: Adding fields to id-ctrl VU region
Per https://github.com/linux-nvme/nvme-cli/pull/584/commits/f33510efbf5192116e5757d13a02463d446a1dc5#r332178975 removing pack pragma on vu_id_ctrl_field struct.
Signed-off-by: Ben Reese <5884008+benreese0@users.noreply.github.com>
Sagi Grimberg [Mon, 7 Oct 2019 18:22:21 +0000 (11:22 -0700)]
udev: convert the discovery event handler to the kernel support
The kernel will not send us a specific event for discovery but
rather the AEN result code. So expect NVME_AEN=0x70f002 for
discovery log change events.
Also, we don't get the NVME_CTRL_NAME env var anymore as this is
available from the device $kernel.
Andy Lutomirski [Thu, 3 Oct 2019 18:47:02 +0000 (11:47 -0700)]
Use a systemd app-specific machine ID for hostnqn
If /etc/nvme/hostnqn is not present, the fabric commands will ask
systemd for an app-specific machine ID as a fallback. This should
improve functionality if /etc/nvme/hostnqn is not present and should
allow packagers to avoid creating /etc/nvme/hostnqn.
Heavily based on an earlier patch from Tomasz Torcz.
Signed-off-by: Tomasz Torcz <tomek@pipebreaker.pl> Signed-off-by: Andy Lutomirski <luto@kernel.org>
On error, scandir returns -1 and does not allocate memory
for namelist array. In some places in the code return value
of scandir call is not checked. This causes nvme-cli to
attempt to free() an uninitialized pointer, which subsequently
leads to segmentation fault.
To address this issue, check return value of scandir calls
throughout the code.
Changes determination of Device Self-Test in progress to be based on the
Current Device Self-Test Operation field as opposed to the Current
Device Self-Test Completion field.
Current implementation assumes that the Current Device Self-Test
Completion field will be 100% when no Device Self-Test operation is in
progress. This is an unsafe assumption as the NVMe Specification
explicitly specifies that the Current Device Self-Test Completion field
is invalid when no Device Self-Test operation in progress as indicated
by a value of 0 in the Current Device Self-Test Operation field.
A safe assumption is to use the Current Device Self-Test Operation field
which will be 0 when no Device Self-Test operation is in progress.
Minwoo Im [Tue, 3 Sep 2019 01:25:37 +0000 (10:25 +0900)]
remove LIBUUID things from nvme.h
We have this structure in linux/nvme.h already.
cc -D_GNU_SOURCE -D__CHECK_ENDIAN__ -O2 -g -Wall -Werror -std=gnu99 -I. -DNVME_VERSION='"1.9.22.g6936.dirty"' -Iutil -o nvme-print.o -c nvme-print.c
In file included from nvme.h:35:0,
from nvme-print.h:4,
from nvme-print.c:7:
linux/nvme.h:24:3: error: conflicting types for ‘uuid_t’
} uuid_t;
^~~~~~
In file included from nvme-print.h:4:0,
from nvme-print.c:7:
nvme.h:32:3: note: previous declaration of ‘uuid_t’ was here
} uuid_t;
^~~~~~
Makefile:70: recipe for target 'nvme-print.o' failed
nvme-print.c: In function ‘show_relatives’:
nvme-print.c:3964:3: error: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Werror=unused-result]
asprintf(&path, "/sys/class/nvme/%s", name);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nvme-print.c:3968:3: error: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Werror=unused-result]
asprintf(&path, "/sys/block/%s/device", name);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Minwoo Im [Sun, 25 Aug 2019 13:28:50 +0000 (22:28 +0900)]
id-ctrl: show Flush command behavior in VWC
Volatile Write Cache(VWC) is now indicating the Flush command behavior
in VWC point-of-view. If 2h, Flush command does not support for the
NSID set to FFFFFFFFh. But in case of 3h, it will support.
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Keith Busch [Thu, 29 Aug 2019 19:38:14 +0000 (13:38 -0600)]
nvme-cli: Macro'ify argument defines
Defining arguments by field type is too repetive and creates excessively
long lines. Simplify this with some macros that handle the more tedious
parts.
Keith Busch [Mon, 26 Aug 2019 22:17:41 +0000 (16:17 -0600)]
nvme-cli: Make 'list' more useful
The original 'list' subcommand was a bit of an ad-hoc development. Not
a whole lot of forethought was made toward subsystems, multipathing,
multi-namespace capabilities.
Those more complicated topologies we see today have become difficult
for users to visualize and understand the relationships among many
devices co-existing in the same, and 'list' has not kept up with these
complications.
As newer kernels provide more information for user space to discover,
provide a more verbose option to list this information while maintaining
backward compatibility for kernels that do not provide nvme subsystem
suppport.
The following examples are using the column format, however I find the
json output more satisfying.
The old way (no verbose options):
# nvme list
Node SN Model Namespace Usage Format FW Rev
---------------- -------------------- ---------------------------------------- --------- -------------------------- ---------------- --------
/dev/nvme0n1 PHLE7200015N6P4BGN-1 7335943:ICDPC5ED2ORA6.4T 1 3.20 TB / 3.20 TB 512 B + 0 B QDV1RD07
/dev/nvme1n1 PHLE7200015N6P4BGN-2 7335943:ICDPC5ED2ORA6.4T 1 3.20 TB / 3.20 TB 512 B + 0 B QDV1RD03
/dev/nvme2n1 CVFT50850022400GGN INTEL SSDPE2MD400G4 1 400.09 GB / 400.09 GB 4 KiB + 0 B 8DV101J0
/dev/nvme3n1 CVMD4215002W1P6DGN INTEL SSDPEDME012T4 1 1.20 TB / 1.20 TB 4 KiB + 0 B 8DV101B0
/dev/nvme4n1 e559e5e004175109 Linux 1 3.20 TB / 3.20 TB 512 B + 0 B 5.3.0-rc
/dev/nvme4n2 e559e5e004175109 Linux 2 3.20 TB / 3.20 TB 512 B + 0 B 5.3.0-rc
/dev/nvme5n1 FUMB5256000J280A INTEL SSDPED1D140GA 1 140.04 GB / 140.04 GB 512 B + 0 B E40A0208
Sagi Grimberg [Thu, 22 Aug 2019 22:09:37 +0000 (15:09 -0700)]
systemd: fix echo call with absolute path
Without placing the absolute path when formatting the
nvme connect-all args we can get the following error:
--
connect-all: unrecognized option '-e'
Discover NVMeoF subsystems and connect to them [ --transport=<LIST>, -t <LIST> ] --- transport type
[ --traddr=<LIST>, -a <LIST> ] --- transport address
[ --trsvcid=<LIST>, -s <LIST> ] --- transport service id (e.g. IP
port)
[ --host-traddr=<LIST>, -w <LIST> ] --- host traddr (e.g. FC WWN's)
[ --hostnqn=<LIST>, -q <LIST> ] --- user-defined hostnqn (if default
not used)
[ --hostid=<LIST>, -I <LIST> ] --- user-defined hostid (if default
not used)
[ --raw=<LIST>, -r <LIST> ] --- raw output file
[ --device=<LIST>, -d <LIST> ] --- use existing discovery controller
device
[ --keep-alive-tmo=<LIST>, -k <LIST> ] --- keep alive timeout period in
seconds
[ --reconnect-delay=<LIST>, -c <LIST> ] --- reconnect timeout period in
seconds
[ --ctrl-loss-tmo=<LIST>, -l <LIST> ] --- controller loss timeout period in
seconds
[ --hdr_digest, -g ] --- enable transport protocol header
digest (TCP transport)
[ --data_digest, -G ] --- enable transport protocol data
digest (TCP transport)
[ --nr-io-queues=<LIST>, -i <LIST> ] --- number of io queues to use
(default is core count)
[ --nr-write-queues=<LIST>, -W <LIST> ] --- number of write queues to use
(default 0)
[ --nr-poll-queues=<LIST>, -P <LIST> ] --- number of poll queues to use
(default 0)
[ --queue-size=<LIST>, -Q <LIST> ] --- number of io queue elements to
use (default 128)
[ --persistent, -p ] --- persistent discovery connection
[ --quiet, -Q ] --- suppress already connected errors
Usage: nvme connect-all <device> [OPTIONS]
Options:
: nvmf-connect@--device\x3dnvme0\t--transport\x3dtcp\t--traddr\x3d192.168.123.1\t--trsvcid\x3d8009\t--host-traddr\x3dnone.service: Main process exited, code=exited, status=70/n/a
: nvmf-connect@--device\x3dnvme0\t--transport\x3dtcp\t--traddr\x3d192.168.123.1\t--trsvcid\x3d8009\t--host-traddr\x3dnone.service: Failed with result 'exit-code'.
Sagi Grimberg [Thu, 22 Aug 2019 22:09:36 +0000 (15:09 -0700)]
nvmf-autoconnect: fix absolute path for systemctl
Without the absolute path udev gets the error:
failed to execute '/lib/udev/systemctl' 'systemctl --no-block start nvmf-connect@[...].service': No such file or directory
Sagi Grimberg [Thu, 22 Aug 2019 21:31:32 +0000 (14:31 -0700)]
nvme: fix compilation error
gcc 7.4.0.
nvme.c: In function ‘print_relatives’:
nvme.c:3505:3: error: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Werror=unused-result]
asprintf(&path, "/sys/class/nvme/%s", devicename);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nvme.c:3509:3: error: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Werror=unused-result]
asprintf(&path, "/sys/block/%s/device", devicename);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
Makefile:57: recipe for target 'nvme' failed
make: *** [nvme] Error 1
Keith Busch [Thu, 22 Aug 2019 16:20:18 +0000 (10:20 -0600)]
nvme-cli: Enhance format FNA detection
Always check the format attributes to verify if the controller will
apply the format to all namespaces, or if they can be individually
formatted. This is used to properly warn of the implications from sending
this command.
Signed-off-by: Keith Busch <keith.busch@intel.com>
Keith Busch [Wed, 21 Aug 2019 22:28:19 +0000 (16:28 -0600)]
nvme-cli: Warn and delay before formatting
By popular demand, have format print a warning that shows the relatives of
the device the format was sent to.
If this command was issued to a block device, its relative are the
parent controllers.
If this command was issued to a controller device, its relative children
are namespace block devices.
This provides a visual clue that /dev/nvme0 may or may not be the parent
controller to namespace /dev/nvme0n1, and provides ample time for the
user to abort the operation if they didn't mean to do this.
Here are some examples of what this change provides sending this command
to a controller first, then to a multipathed namespace:
# nvme format /dev/nvme0 -n 1
You are about to format nvme0, namespace 0x1.
Controller nvme0 has child namespace(s):nvme2n1
# nvme format /dev/nvme4n1
You are about to format nvme4n1, namespace 0x1.
Namespace nvme4n1 has parent controller(s):nvme4, nvme5
Keith Busch [Thu, 15 Aug 2019 19:14:59 +0000 (13:14 -0600)]
Tag release: v1.9
Thank you to everyone who contributed to this release. Many updates for
the new 1.4 spec are rolling out, fabrics control enhancments, vendor
plugins/extentions, and the usual miscellaneous improvements to output
and options all included.
Shortlog:
Akinobu Mita (4):
nvme-cli: add missing endianness conversions for telemetry log page
nvme-cli: cleanup comments for telemetry log structure
nvme-cli: add kernel-doc comment for struct telemetry_log_page_hdr
nvme-cli: remove unused NVME_AER_NOTICE_*
Alexander Larin (1):
Use 0x prefix for all hex values of id-ctrl output
Andy Lutomirski (1):
Fix passing CFLAGS on the make command line.
Bart Van Assche (16):
Remove superfluous casts
Use NULL instead of 0 where a pointer is expected
huawei: Declare local functions static
seagate: Declare local functions static
virtium: Declare local symbols static
lightnvm: Fix an endianness issue
virtium: Fix an endianness issue
wdc: Fix endianness bugs
Avoid using arrays with a variable length
nvme-cli: Rework the code for getting and setting NVMf properties
nvme-cli: Skip properties that are not supported
Introduce NVMe 1.4 Identify Namespace fields in struct nvme_id_ns
nvme-cli: Report the NVMe 1.4 NPWG, NPWA, NPDG, NPDA and NOWS fields
nvme-cli: Restore support for older gcc versions
nvme-cli: Restore RHEL 7 compatibility
nvme-cli: Fix more endianness issues
Chaitanya Kulkarni (6):
nvme-cli: cmbloc code cleanup
nvme-cli: code cleanup adjust if statement
nvme-cli: remove trailing space
nvme-cli: use uniform if .. else format
nvme-cli: use uniform if .. else format
nvme-cli: use uniform if .. else format
Dominique Leuenberger (1):
DOC: Move to DocBook 5 when using asciidoctor
Hannes Reinecke (3):
nvme-cli: do not use 'queue_size' and 'nr_io_queues' for discovery controller
nvme-cli: mask out invalid options during discovery
nvme-cli: Update manpages to reflect discovery particulars
Haochen Tong (2):
Fix code block style in the first section
Update packaging state in Arch Linux
James Smart (8):
nvme-cli: ignore arguments that pass in "none"
nvme-cli: allow discover to address discovery controller by persistent name
nvme-cli: Refactor to create a get_nvme_ctrl_info routine
nvme-cli: extend ctrl_list_item for connect attributes
nvme-cli: Add routine to compare ctrl_list_item to connect args
nvme-cli: Add routine to search for controller with specific attributes
nvme-cli: Expand --device argument processing
nvme-cli: nvmf auto-connect scripts
Jeff Lien (4):
[NVMe-CLI] WDC: Add support for 64 bit data addresses in Get DUI Data functions
Add verbose capability to get DUI function to improve debug
[NVMe-CLI] Add support for SN730 to WDC plugin commmands
[NVMe-CLI] Add support for larger data sizes needed to get DUI data.
Jeffrey Lien (2):
Fix Failure to read 0xCA Log Page on SN200 Device [NVMe-CLI] Fix Incorrect Data Formats with the 0xCA and 0xD0 Log Pages
Add Disable IO flag to wdc_dump_dui_data function
Keith Busch (10):
Revert "plugin: Return EINVAL instead of ENOTTY"
Regen docs
Reorder primary commands
remove non-portable compile-time check
Add a note to format on device naming conventions
respin documentation
doc: fixup 3rd party man page
Spin documentation
Fix sprintf truncate
Regen docs
Kenneth Heitke (12):
nvme: fix minor type in id-ctrl human readable output
nvme-cli: add identify secondary controller list
nvme-print: update self-test log to include 'aborted due to sanitize'
nvme-print: remove Virtual Management support from ONCS
nvme-print: add pretty print for estimated sanitize time
nvme-print: add JSON for NVMe 1.4 NPWG, NPWA, NPDG, NPDA and NOWS fields
nvme-print: Show value for Transport SGL Data Block Descriptor support
nvme: add Verify command
nvme: Enhanced Command Retry
nvme: sanitize enhancements
nvme: add support for Namespace Granularity
nvme-print: show new CMBLOC bit fields added in NVMe 1.4
Max Gurtovoy (5):
nvme: update list-ns nsid option
nvme: update description for "nvme list" command
fabrics: Fix memory leak of subsys list
nvme-print: fix json object memory leak
nvme: fix coding style issue
Minwoo Im (37):
nvme: Close a fd leaked
plugin: Return EINVAL instead of ENOTTY
ioctl: Fix double-free in a loop of get_property
ioctl: Fix wrong return case of get_property
print: Introduce show_nvme_status to print nvme status
print: Add const to return type of string
get-telemtry-log: Print nvme status in case err > 0
sanitize: Print nvme status in case ret > 0
format: Do not return directly without freeing fd
create-ns: Do not return directly without freeing fd
list-ctrl: Do not return directly without freeing fd
property: Introduce inline function to check 64bit reg
property: Remove unnecessary wrapper function
property: Fit print size for a property
nvme.h: Fix typos in status code values
nvme-cli: don't try to disconnect for ctrl with pcie transport
nvme-cli: remove unnecessary initialize of local var
nvme: Do not return in the middle of the subcommand
fabrics: Do not return in the middle of the subcommand
nvme: Return negative error value for internal errors
nvme-status: Introduce nvme status module to map errno
nvme: Return errno mapped for nvme error status
fabrics: return error when discovery retry exhausted
fabrics: Return errno mapped for fabrics error status
format: check BLKRRPART failure
nvme: clean up goto labels without whitespace
lnvm: remove redundant whitespace in lnvm_init()
lnvm: do not print 0 when the arg is not given
lnvm: cast identity structure to (void *) directly
doc: make description not only for PCIe
doc: add extension plugins' command format
lnvm: make data_len to sizeof() instead of magic number
lnvm: introduce chunk-log command for chunk info
lnvm: introduce alias geometry for id-ns for lnvm
id-ctrl: add an indicator for get lba status capability
id-ctrl: add 1.4 features to OAES
get-lba-status: add Get LBA Status command
Revanth Rajashekar (2):
nvme: add Persistent Memory Region (PMR) registers
nvme: UUIDs for Vendor-Specific Information
Sagi Grimberg (4):
spec, Makefile: add /etc/nvme files to package files
spec, make: Add discovery.conf to the package files list
nvme-cli: support persistent connections to a discovery controller
nvme-cli: add --quiet option
Shun Sakai (1):
Added openSUSE Leap to README.md
Simon Schricker (3):
nvme-cli: fix typo, removing the duplicate 'are'
nvme-cli: Increase size of ONTAP namespace path variable
nvme-vendor: fix c99 declarations in vendor plugins
Yair Elharrar (1):
nvme: change format default namespace id
Yoav Cohen (4):
fix json print for list-subsys command
add newline for command show-regs
add free call for json object for commands show-regs
add namespace to json output of nvme list
yongxing (1):
NVMe-Cli Shannon Plugin-add support for shannon systems.
丁剑 (1):
[Log] Memblaze add more log infomation for S.M.A.R.T.
Signed-off-by: Keith Busch <keith.busch@intel.com>
Revanth Rajashekar [Wed, 14 Aug 2019 18:51:00 +0000 (12:51 -0600)]
nvme: UUIDs for Vendor-Specific Information
1. Add 'id-uuid' command to show the available UUID list
2. Update the get-log, get-feature, and set-feature commands
to include a uuid-index parameter
a. If set, the index will be passed as part of DW14 to
the controller
3. Update show_nvme_id_ctrl_ctratt() to show bit 9 of the CTRATT
(UUID List Supported)
4. Update show_effects_log_human() to show the UUID selection bit
of the effects log
Revanth Rajashekar [Tue, 6 Aug 2019 21:36:45 +0000 (15:36 -0600)]
nvme: add Persistent Memory Region (PMR) registers
*update 'show-regs' to display the new PMR registers (PMRCAP, PMRCTL, PMRSTS)
*update 'show-regs' to display the PMRS bit of the Controller Capabilities Register
*add support for error status NVME_SC_SANITIZE_PROHIBITED_PMR