Warner Losh [Sat, 4 May 2024 03:32:07 +0000 (21:32 -0600)]
solidigm: Eliminate <linux/limits.h>
ARG_MAX is defined in <limits.h>, per POSIX, but it's defined to be a
variable in glibc. Instead, get rid of it entirely by using asprintf to
construct the commands. This prevents us from trying a partially
constructed command that might do something unintentional. For
solidigm-market-log.c, there's no constants needed from
<linux/limits.h>. With this we can delete it both places.
Francis Pravin [Fri, 10 May 2024 09:46:36 +0000 (15:16 +0530)]
nvme: remove double free in persistent-event-log
The pevent_collected structure uses the buffer address which is allocated
using nvme_alloc_huge(). So, pevent_collected and mh.p has same address.
Hence, remove _cleanup_free_ from pevent_collected to prevent double free.
Signed-off-by: Francis Pravin <francis.p@samsung.com> Signed-off-by: Sathyavathi M <sathya.m@samsung.com>
Arthur Shau [Thu, 9 May 2024 18:41:16 +0000 (11:41 -0700)]
ocp: Add Get DSSD Power State Feature (FID: C7h)
Implements the Get DSSD Power State Feature (FID C7h). Also added an
optional flag that you can pass to the plugin command to print out
all three values at once.
Leonardo da Cunha [Mon, 29 Apr 2024 22:00:35 +0000 (15:00 -0700)]
plugins/solidigm: Automatic enabling Data Area 4 when retrieving Telemetry.
vs-internal-log, stopped extracting Host Initiated Telemetry previous
snapshot, simplified the type name of Telemetry snapshots to CIT and HIT,
removed command options for setting namespace, and file prefix, and added
command option to set output folder.
Signed-off-by: Leonardo da Cunha <leonardo.da.cunha@solidigm.com>
Sebastian Brzezinka [Mon, 12 Sep 2022 13:02:53 +0000 (15:02 +0200)]
plugins/spdk: plugin to list SPDK subsystems
Since `nvme-cli` start using `sysfs` to gather information about
subsystems, SPDK devices that are represented using CUSE can
no longer be listed.
Support for the JSON format is disabled cause `nvme_ctrl_get_state` use
sysfs to get value, causing segmentation fault when it's missing.
It could be solved by providing an empty string instead of a NULL pointer.
This patch adds SPDK devices to the nvme_root topology tree,
$ nvme spdk list-subsys
Signed-off-by: Sebastian Brzezinka <sebastian.brzezinka@intel.com> Signed-off-by: Daniel Wagner <dwagner@suse.de>
Sebastian Brzezinka [Fri, 26 May 2023 09:23:37 +0000 (11:23 +0200)]
nvme-print: check if controller belong to SPDK
Check if controller belongs to SPDK cuse devices and compare paths
to make it possible to distinguish SPDK devices and not rely on
order and existence of a file.
Signed-off-by: Sebastian Brzezinka <sebastian.brzezinka@intel.com> Signed-off-by: Daniel Wagner <dwagner@suse.de>
Tomasz Zawadzki [Wed, 23 Mar 2022 12:41:40 +0000 (13:41 +0100)]
plugins/spdk: plugin to list SPDK controllers
Since libnvme and nvme-cli(2.0) are continuing as separate projects,
and libnvme use sysfs exclusively to gather information about NVMe
devices, legacy paths that allow specifying a custom directory ('-d`)
is no longer available.
SPDK, as a userspace driver, does not create a sysfs entry but makes it
possible to expose such devices via NVMe-cuse and since it behaves as
character device, most commands should be intact, except
listing devices and subsystems.
This patch adds SPDK devices to the nvme_root topology tree, which
allows for keeping functionality where both SPDK and kernel devices
are printed.
$ nvme spdk list
Signed-off-by: Sebastian Brzezinka <sebastian.brzezinka@intel.com> Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Signed-off-by: Daniel Wagner <dwagner@suse.de>
nvme_cli_get_log_ana_groups() is not called anywhere.
In preparation for a libnvme change that changes the signature
of nvme_get_log_ana_groups(), just remove the function.
Warner Losh [Mon, 29 Apr 2024 17:43:53 +0000 (11:43 -0600)]
sed_opal: Only build when we really have sed_opal headers
There's already code to not build the sed opal plugin when the necessary
headers aren't present. However, it doesn't work, since HAVE_SED_OPAL is
always defined to be either 0 or 1, so the meson has() return true, even
when the value is 0, causing the sed-opal plugin to build, even when the
header files it needs are missing.
Daniel Wagner [Tue, 4 Apr 2023 12:06:03 +0000 (14:06 +0200)]
nvmf-connect: systemd hardening effort
Apply the recommended hardening settings as recommended by openSUSE
and Fedor project. A few of the hardening option have to turned of
because nvme-cli needs write access to sysfs and /dev/nvme devices.
Links: https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort
Links: https://fedoraproject.org/wiki/Changes/SystemdSecurityHardening Signed-off-by: Daniel Wagner <dwagner@suse.de>
Martin George [Tue, 16 Apr 2024 07:38:11 +0000 (13:08 +0530)]
nvme: fix mem leak in multiple key related functions
Valgrind revealed mem leaks in multiple key related functions
including gen_tls_key() and check_tls_key() during insert, and
gen_dhchap_key(). This was traced to the respective cfg pointer
not getting freed after fetching the hostnqn string from the
hostnqn file. Fix the same.
Martin George [Mon, 15 Apr 2024 07:14:32 +0000 (12:44 +0530)]
fabrics: fix mem leak in nvmf_check_hostid_and_hostnqn()
Valgrind revealed a mem leak in nvmf_check_hostid_and_hostnqn()
during nvme discover & connect. Leak traced to both hostid
pointers not getting freed for cases where the hostid value
matches the strings from both these respective hostid pointers.
Fix the same.
Brandon Paupore [Tue, 26 Mar 2024 15:27:07 +0000 (10:27 -0500)]
ocp: Unify line start spacing as tabs
Most of the ocp-nvme.c file already uses tabs in this way, but some
functions are using spaces instead. Unify this to follow the checkpatch
preference for code indents using tabs where possible.
Tomas Bzatek [Mon, 25 Mar 2024 15:35:31 +0000 (16:35 +0100)]
nbft: Refactor connection attempt out
With planned NBFT discovery work, a common connection
function would be handy. Besides, the DHCP fallback mostly
duplicated the connection code anyway, let's refactor that.
Martin George [Sat, 6 Apr 2024 12:47:25 +0000 (18:17 +0530)]
nvme: check-tls-key fails despite having hostnqn file
Nvme check-tls-key requires both hostnqn and subsysnqn to be
specified along with the keydata. Ideally, it should be able to
fetch the hostnqn string from the hostnqn file if no hostnqn
option is passed, irrespective of whether the insert option is
specified or not. Also passing the subsysnqn option is required
not just for identity v1, but for v0 as well, irrespective of
the insert option. Fix accordingly.
fabrics : allow host to create duplicate connections to target
Apparently the nvmf connect code doesn't allow creating
duplicate connections from a host to the same target even
though user specifies option "--duplicate-connect" or "-D".
This patch help fix this issue.
Fixes: 07d6b911e081 ("fabrics: Do not attempt to reconnect to already connected ctrls") Reported-by: Amit Engel <Amit.Engel@Dell.com> Signed-off-by: Nilay Shroff <nilay@linux.ibm.com> Link: https://lore.kernel.org/r/20240403133438.161916-1-nilay@linux.ibm.com Signed-off-by: Daniel Wagner <dwagner@suse.de>
Minsik Jeon [Thu, 28 Mar 2024 04:50:28 +0000 (13:50 +0900)]
nvme-print-json: Bugfix status json key of sanitize-log
There is a history of combining duplicated json keys before. Fixes: 1d7c092f9dac ("nvme-print-json: Combine duplicated json key and val string variables") Fixes: 59a0f125cb08 ("nvme-print-json: Delete static const char string global variables")
But there is a local variable with the same name, so the key and value
are the same.
Reviewed-by: Sangkuk Lee <sangkuk0.lee@samsung.com> Reported-by: Kiryong Kim <kiryong1.kim@samsung.com> Signed-off-by: Minsik Jeon <hmi.jeon@samsung.com> Co-authored-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
Greg Joyce [Wed, 27 Mar 2024 17:40:53 +0000 (12:40 -0500)]
sed: update SED password when initalizing
The SED key and kernel keyring were not being updated by the
initialization operation. Add password update after the other
initialization tasks are completed.