nvme-cli: fix ctrl_loss_tmo support

Resolves: #2020283

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
This commit is contained in:
Maurizio Lombardi 2021-12-09 16:07:26 +01:00
parent 761bfc63e4
commit 0e497cc522
2 changed files with 50 additions and 2 deletions

View File

@ -0,0 +1,43 @@
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

@ -3,7 +3,7 @@
Name: nvme-cli
Version: 1.14
Release: 3%{?dist}
Release: 4%{?dist}
Summary: NVMe management command line interface
License: GPLv2+
@ -12,6 +12,7 @@ Source0: https://github.com/linux-nvme/%{name}/archive/v%{version}.tar.gz
Patch0: nvme-cli-makefile-dont-install-host-params-patch
Patch1: 0001-default-flush-to-use-block-device-nsid.patch
Patch2: 0001-nvme-cli-ctrl-loss-tmo-should-accept-1-as-value.patch
BuildRequires: libuuid-devel
BuildRequires: gcc
@ -26,6 +27,7 @@ nvme-cli provides NVM-Express user space tooling for Linux.
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%build
@ -83,6 +85,9 @@ if [ $1 -eq 1 ] || [ $1 -eq 2 ]; then
fi
%changelog
* Thu Dec 09 2021 Maurizio Lombardi <mlombard@redhat.com> - 1.14-4
- Fix handling of the ctrl_loss_tmo parameter
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com>
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
@ -96,7 +101,7 @@ fi
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com>
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Fri Mar 19 2020 Maurizio Lombardi <mlombard@redhat.com> - 1.12-1
* Fri Mar 19 2021 Maurizio Lombardi <mlombard@redhat.com> - 1.12-1
- Update to 1.13 and add postin scriptlet
* Sat Apr 25 2020 luto@kernel.org - 1.11.1-1