nvme-cli: update to version 1.16

Resolves: #2031004

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
This commit is contained in:
Maurizio Lombardi 2021-12-13 13:28:43 +01:00
parent 0e497cc522
commit ed979f6548
8 changed files with 108 additions and 81 deletions

1
.gitignore vendored
View File

@ -19,3 +19,4 @@
/v1.11.1.tar.gz /v1.11.1.tar.gz
/v1.13.tar.gz /v1.13.tar.gz
/v1.14.tar.gz /v1.14.tar.gz
/v1.16.tar.gz

View File

@ -1,33 +0,0 @@
From 6abc4f36b38aa6be3c7e4b89e2997e5006e40b37 Mon Sep 17 00:00:00 2001
From: Keith Busch <kbusch@kernel.org>
Date: Tue, 1 Jun 2021 07:01:44 -0700
Subject: [PATCH] default flush to use block device nsid
Kernel 5.13 added checks to ensure the ioctl path can't be abused to
access a different namespace than the one user space has permission to
open. This unfortunately breaks the all-nsid flush usage, so user
tooling needs to default to the device's namespace id.
Link: https://lore.kernel.org/linux-nvme/20210518144249.GE2709569@dhcp-10-100-145-180.wdc.com/T/#t
Link: https://github.com/linux-nvme/nvme-cli/issues/1066
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
nvme.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/nvme.c b/nvme.c
index 87e1a82..1666ba5 100644
--- a/nvme.c
+++ b/nvme.c
@@ -4384,7 +4384,7 @@ static int flush(int argc, char **argv, struct command *cmd, struct plugin *plug
};
struct config cfg = {
- .namespace_id = NVME_NSID_ALL,
+ .namespace_id = 0,
};
OPT_ARGS(opts) = {
--
2.31.1

View File

@ -0,0 +1,32 @@
From f74ac1b841b0aae73969debaed0444f0ecb03dba Mon Sep 17 00:00:00 2001
From: Martin George <marting@netapp.com>
Date: Mon, 15 Nov 2021 16:00:47 +0530
Subject: [PATCH 1/3] fabrics: fix 'nvme connect' segfault if transport type is
omitted
Check if the transport type is available before dereferencing
it in discovery_trsvcid().
Fixes: 362c90f ("fabrics: add default port number for NVMe/TCP I/O
controllers")
Signed-off-by: Martin George <marting@netapp.com>
---
fabrics.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fabrics.c b/fabrics.c
index d691191..adca89b 100644
--- a/fabrics.c
+++ b/fabrics.c
@@ -1070,6 +1070,8 @@ static void set_discovery_kato(struct fabrics_config *cfg)
static void discovery_trsvcid(struct fabrics_config *fabrics_cfg, bool discover)
{
+ if (!fabrics_cfg->transport)
+ return;
if (!strcmp(fabrics_cfg->transport, "tcp")) {
if (discover) {
/* Default port for NVMe/TCP discovery controllers */
--
2.27.0

View File

@ -1,43 +0,0 @@
diff --git a/fabrics.c b/fabrics.c
index 7dd0d27..e831882 100644
--- a/fabrics.c
+++ b/fabrics.c
@@ -68,7 +68,7 @@ const char *conarg_trsvcid = "trsvcid";
const char *conarg_host_traddr = "host_traddr";
struct fabrics_config fabrics_cfg = {
- .ctrl_loss_tmo = -1,
+ .ctrl_loss_tmo = NVMF_DEF_CTRL_LOSS_TMO,
.output_format = "normal",
};
@@ -913,7 +913,7 @@ add_int_argument(char **argstr, int *max_len, char *arg_str, int arg,
{
int len;
- if ((arg && !allow_zero) || (arg != -1 && allow_zero)) {
+ if (arg || allow_zero) {
len = snprintf(*argstr, *max_len, ",%s=%d", arg_str, arg);
if (len < 0)
return -EINVAL;
@@ -954,9 +954,6 @@ int build_options(char *argstr, int max_len, bool discover)
msg(LOG_ERR, "need a address (-a) argument\n");
return -EINVAL;
}
- /* Use the default ctrl loss timeout if unset */
- if (fabrics_cfg.ctrl_loss_tmo == -1)
- fabrics_cfg.ctrl_loss_tmo = NVMF_DEF_CTRL_LOSS_TMO;
}
/* always specify nqn as first arg - this will init the string */
@@ -991,8 +988,9 @@ int build_options(char *argstr, int max_len, bool discover)
(strncmp(fabrics_cfg.transport, "loop", 4) &&
add_int_argument(&argstr, &max_len, "ctrl_loss_tmo",
fabrics_cfg.ctrl_loss_tmo, true)) ||
+ (fabrics_cfg.tos != -1 &&
add_int_argument(&argstr, &max_len, "tos",
- fabrics_cfg.tos, true) ||
+ fabrics_cfg.tos, true)) ||
add_bool_argument(&argstr, &max_len, "duplicate_connect",
fabrics_cfg.duplicate_connect) ||
add_bool_argument(&argstr, &max_len, "disable_sqflow",

View File

@ -0,0 +1,29 @@
From ff8f9b6f59b574fda24a071fb0af4381c0cc6d9f Mon Sep 17 00:00:00 2001
From: Maurizio Lombardi <mlombard@redhat.com>
Date: Thu, 9 Dec 2021 12:21:51 +0100
Subject: [PATCH 2/3] fabrics: fix a buffer overrun
the uuid buffer size must be at least 37 bytes to avoid
corrupting the memory
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
---
fabrics.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fabrics.c b/fabrics.c
index adca89b..0766729 100644
--- a/fabrics.c
+++ b/fabrics.c
@@ -883,7 +883,7 @@ static char *hostnqn_generate_systemd(void)
static char *hostnqn_read_dmi(void)
{
- char uuid[16];
+ char uuid[37];
char *ret = NULL;
if (uuid_from_dmi(uuid) < 0)
--
2.27.0

View File

@ -0,0 +1,36 @@
From 821935cccfcad6b18da78d42f9ddf49f4cbe0b8e Mon Sep 17 00:00:00 2001
From: Daniel Wagner <dwagner@suse.de>
Date: Thu, 9 Dec 2021 15:40:26 +0100
Subject: [PATCH 3/3] bash: Fix nvme completion
Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
completions/bash-nvme-completion.sh | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/completions/bash-nvme-completion.sh b/completions/bash-nvme-completion.sh
index 41938d7..902da01 100644
--- a/completions/bash-nvme-completion.sh
+++ b/completions/bash-nvme-completion.sh
@@ -101,8 +101,7 @@ _cmds="list list-subsys id-ctrl id-ns \
connect disconnect disconnect-all gen-hostnqn \
show-hostnqn dir-receive dir-send virt-mgmt \
rpmb boot-part-log fid-support-effects-log \
- supported-log-pages lockdown"
- supported-log-pages list-endgrp"
+ supported-log-pages lockdown list-endgrp"
# Add plugins:
for plugin in "${!_plugin_subcmds[@]}"; do
@@ -1368,7 +1367,7 @@ plugin_ymtc_opts () {
opts+=" --namespace-id= -n --raw-binary -b"
;;
"help")
- opts+=NO_OPTS
+ opts+=$NO_OPTS
;;
esac
--
2.27.0

View File

@ -2,8 +2,8 @@
#%%global shortcommit0 %%(c=%%{commit0}; echo ${c:0:7}) #%%global shortcommit0 %%(c=%%{commit0}; echo ${c:0:7})
Name: nvme-cli Name: nvme-cli
Version: 1.14 Version: 1.16
Release: 4%{?dist} Release: 2%{?dist}
Summary: NVMe management command line interface Summary: NVMe management command line interface
License: GPLv2+ License: GPLv2+
@ -11,8 +11,9 @@ URL: https://github.com/linux-nvme/nvme-cli
Source0: https://github.com/linux-nvme/%{name}/archive/v%{version}.tar.gz Source0: https://github.com/linux-nvme/%{name}/archive/v%{version}.tar.gz
Patch0: nvme-cli-makefile-dont-install-host-params-patch Patch0: nvme-cli-makefile-dont-install-host-params-patch
Patch1: 0001-default-flush-to-use-block-device-nsid.patch Patch1: 0001-fabrics-fix-nvme-connect-segfault-if-transport-type-.patch
Patch2: 0001-nvme-cli-ctrl-loss-tmo-should-accept-1-as-value.patch Patch2: 0002-fabrics-fix-a-buffer-overrun.patch
Patch3: 0003-bash-Fix-nvme-completion.patch
BuildRequires: libuuid-devel BuildRequires: libuuid-devel
BuildRequires: gcc BuildRequires: gcc
@ -28,6 +29,7 @@ nvme-cli provides NVM-Express user space tooling for Linux.
%patch0 -p1 %patch0 -p1
%patch1 -p1 %patch1 -p1
%patch2 -p1 %patch2 -p1
%patch3 -p1
%build %build
@ -85,6 +87,9 @@ if [ $1 -eq 1 ] || [ $1 -eq 2 ]; then
fi fi
%changelog %changelog
* Mon Dec 13 2021 Maurizio Lombardi <mlombard@redhat.com> - 1.16-2
- Update to the latest version
* Thu Dec 09 2021 Maurizio Lombardi <mlombard@redhat.com> - 1.14-4 * Thu Dec 09 2021 Maurizio Lombardi <mlombard@redhat.com> - 1.14-4
- Fix handling of the ctrl_loss_tmo parameter - Fix handling of the ctrl_loss_tmo parameter

View File

@ -1 +1 @@
SHA512 (v1.14.tar.gz) = b5e18708233fd37069d84ee34232d737ed6d6909b0ec523d82cc2c4940172f7ce769b9bbec0d8615ebee544a5174cb4d752ad6d96ea05cfaa1177efc760f0e9e SHA512 (v1.16.tar.gz) = c713eb15b979ad17791cf95717b42d5f638cb4803d646bca1f4825e6bb50f086226b44b108b61571709b2cb615ae6ba86dbad309f675b240ebd3968d1cf536ff