From 0e497cc522d908c8834624598372635418409fcb Mon Sep 17 00:00:00 2001 From: Maurizio Lombardi Date: Thu, 9 Dec 2021 16:07:26 +0100 Subject: [PATCH] nvme-cli: fix ctrl_loss_tmo support Resolves: #2020283 Signed-off-by: Maurizio Lombardi --- ...rl-loss-tmo-should-accept-1-as-value.patch | 43 +++++++++++++++++++ nvme-cli.spec | 9 +++- 2 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 0001-nvme-cli-ctrl-loss-tmo-should-accept-1-as-value.patch diff --git a/0001-nvme-cli-ctrl-loss-tmo-should-accept-1-as-value.patch b/0001-nvme-cli-ctrl-loss-tmo-should-accept-1-as-value.patch new file mode 100644 index 0000000..bdb8afe --- /dev/null +++ b/0001-nvme-cli-ctrl-loss-tmo-should-accept-1-as-value.patch @@ -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", diff --git a/nvme-cli.spec b/nvme-cli.spec index 38acf08..abfbe5f 100644 --- a/nvme-cli.spec +++ b/nvme-cli.spec @@ -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 - 1.14-4 +- Fix handling of the ctrl_loss_tmo parameter + * Mon Aug 09 2021 Mohan Boddu - Rebuilt for IMA sigs, glibc 2.34, aarch64 flags Related: rhbz#1991688 @@ -96,7 +101,7 @@ fi * Fri Apr 16 2021 Mohan Boddu - Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 -* Fri Mar 19 2020 Maurizio Lombardi - 1.12-1 +* Fri Mar 19 2021 Maurizio Lombardi - 1.12-1 - Update to 1.13 and add postin scriptlet * Sat Apr 25 2020 luto@kernel.org - 1.11.1-1