Daniel Wagner [Wed, 25 May 2022 15:33:08 +0000 (17:33 +0200)]
nvme-print: Show paths from the first namespace only
When listing the subsystem, show the path from the first namespace
only. Every namespace has the same paths for a subsystem. This avoids
listening the same controllers for each namespace.
Daniel Wagner [Thu, 19 May 2022 12:14:47 +0000 (14:14 +0200)]
fabrics: Honor config file for connect-all
The command line option -J config.json allows to provide a
configuration via a JSON file. We handle this correctly for the
'connect' case but fail to apply the configuration for 'connect-all'
because we missed to add nvme_read_config() in this path.
Daniel Wagner [Wed, 18 May 2022 06:19:23 +0000 (08:19 +0200)]
build: Clarify current main project license
The original desired license for the project was GPL-2.0-or-later
but during the development a few files (e.g. fabrics.c and nvme.h)
got added which are licensed as GPL-2.0-only, which renders the
whole project to GPL-2.0-only.
Update the meson license field and the nvme.spec license field.
While at it mentions this in the contributions notes as well.
Daniel Wagner [Tue, 17 May 2022 06:02:56 +0000 (08:02 +0200)]
ocp: Update license to GPL-2.0-or-later
When I reviewed the plugin I asked wrongly for GPL-2.0-only. The
project is using the GPL-2.0-or-later license. Relax the license
requirement to GPL-2.0-or-later.
Brad Mouring [Tue, 3 May 2022 03:38:24 +0000 (22:38 -0500)]
completions: Collapse declaration and attribute assignment
Previously, the associative arrays for the vendor/subcommands and
vendor/functions listings were split into a declaration of type
(using "typeset") and attribute definition (using "readonly"). On
bash 5.1.16 (at least), this lead to the following error (reported
after enabling -xv to expand and print shell inputs)
...
+ . /usr/share/bash-completion/completions/nvme
# bash tab completion for the nvme command line utility
# (unfortunately, bash won't let me add descriptions to cmds)
# Kelly Kaoudis kelly.n.kaoudis at intel.com, Aug. 2015
# Constant to indicate command has no options
readonly NO_OPTS=""
++ readonly NO_OPTS=
++ NO_OPTS=
# Associative array of plugins and associated subcommands
# Order here is same as PLUGIN_OBJS in Makefile
typeset -A _plugin_subcmds
++ typeset -A _plugin_subcmds
readonly _plugin_subcmds=(
[intel]="id-ctrl internal-log lat-stats \
...
++ _plugin_subcmds=(['intel']='id-ctrl internal-log lat-stats...
bash: 'intel': syntax error: operand expected (error token is "'intel'")
...
Using the available flags for "typeset" to declare the variables as
readonly arrays resolved the issue (and allows for bash completion
to work as-expected)
Hannes Reinecke [Fri, 22 Apr 2022 11:10:01 +0000 (13:10 +0200)]
plugins/seagate: fixup byte calculation
When calculating the number of bytes from the number of blocks one
has to ensure that the values can't overflow, so use a large data
type for the number of bytes than for the number of blocks.
Hannes Reinecke [Fri, 22 Apr 2022 11:04:37 +0000 (13:04 +0200)]
plugins/wdc: coverity fixes
Coverity found an off-by-one error when printing raw values; looks
like someone forgot convert the 1-based NVMe spec convention into
the 0-based C convention.
And, of course, various resource leaks.
Hannes Reinecke [Fri, 22 Apr 2022 10:31:40 +0000 (12:31 +0200)]
plugins: close filedescriptors
For some reasons the plugin authors don't seem to believe in having
to close filedecriptors. Coverity, OTOH, does.
So fix them up to close filedescriptors after use.
Steven Seungcheol Lee [Tue, 12 Apr 2022 05:45:46 +0000 (14:45 +0900)]
nvme: Fix error when passthru does not match opcode based flags
when write option is set(but opcode is not), file should open with read flag
same for read
it occur 'Bad file descriptor' error when access the file
write & read flags are set by opcode as well
Spec mentioned below about opcode(01:00 Data Transfer)
All options to the command shall transfer data as specified or transfer no data.
All commands, including vendor specific commands
01b = host to controller; 10b = controller to host
Reported-by: Kyungsik Shin <ks1012.shin@samsung.com> Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
Daniel Wagner [Wed, 13 Apr 2022 19:31:02 +0000 (21:31 +0200)]
nvme: output also libnvme version
Print the used libnvme version which the nvme-cli fronent is using.
In order to be backward compatible don't expect that the newly
introduce function in libnvme to be 1available.
This is done by providing a weak symbol which is overwritten when
statically build or when libnvme is is used as shared libray the
dlsym() call checks if the function is available.
Daniel Wagner [Tue, 12 Apr 2022 11:52:59 +0000 (13:52 +0200)]
nvme: Add git ref to the binary
In order to be able to figure out which binary is in use (for example
in debugging situation) it's really helpful to have the 'git describe'
ref added to the binary.
$ .build/nvme --version
nvme version 2.0 (git 2.0-2-gcbd3f8d+)
$ .build/nvme wdc --version
nvme wdc version 1.16.4 (git 2.0-2-gcbd3f8d+)
Martin George [Wed, 13 Apr 2022 15:16:35 +0000 (20:46 +0530)]
fabrics: skip connect if the transport types don't match
Discovery log page data may include records belonging to different
transport types. If during a nvme connect-all, a connect is attempted
on a record that doesn't match the transport type passed here, it
would end up in a connect failure for that record. For e.g. one would
see the following error if a connect is attempted on a tcp record,
but the transport type passed here is 'fc' and its associated params:
Martin George [Mon, 11 Apr 2022 04:06:20 +0000 (09:36 +0530)]
fabrics: avoid segfault when nvme discover fails with the -p option
If the initial discovery controller creation fails while passing
the -p option to the nvme discover (or connect-all) command, it
could lead to the below segfault:
nvme discover -t rdma -w 192.168.1.114 -a 192.168.1.113 -p
Failed to write to /dev/nvme-fabrics: Connection reset by peer
Segmentation fault (core dumped)
Avoid this segfault by checking if the controller created in
__create_discover_ctrl() is valid before proceeding.
Martin George [Mon, 11 Apr 2022 12:03:17 +0000 (17:33 +0530)]
fabrics: error message for nvme discover/connect-all with no params
Currently when nvme discover or connect-all is called without
passing any params, it simply blanks out without any meaningful
error. So add an appropriate error message for such scenarios,
similar to what's done in the erstwhile nvme-cli-monolithic branch.