From 5c4e4ec21e63bf26d4d5adbbdcc7ab943f452218 Mon Sep 17 00:00:00 2001 From: eabdullin Date: Wed, 15 May 2024 07:57:28 +0000 Subject: [PATCH] Import from AlmaLinux stable repository --- .gitignore | 2 +- .nvme-cli.metadata | 2 +- ...trl_loss_tmo-to-1-for-ONTAP-NVMe-TCP.patch | 29 ++++++ ...2-udev-rules-rename-netapp-udev-rule.patch | 50 ++++++++++ ...se-corresponding-hostid-when-hostnqn.patch | 92 +++++++++++++++++ ...ntation-fault-when-getting-host-init.patch | 29 ++++++ SPECS/nvme-cli.spec | 98 ++++++++++++++----- 7 files changed, 277 insertions(+), 25 deletions(-) create mode 100644 SOURCES/0001-udev-rules-set-ctrl_loss_tmo-to-1-for-ONTAP-NVMe-TCP.patch create mode 100644 SOURCES/0002-udev-rules-rename-netapp-udev-rule.patch create mode 100644 SOURCES/0003-Revert-fabrics-Use-corresponding-hostid-when-hostnqn.patch create mode 100644 SOURCES/0004-nvme-Fixed-segmentation-fault-when-getting-host-init.patch diff --git a/.gitignore b/.gitignore index feba743..441fe03 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/nvme-cli-2.2.1.tar.gz +SOURCES/nvme-cli-2.6.tar.gz diff --git a/.nvme-cli.metadata b/.nvme-cli.metadata index 2a37014..d9f8a67 100644 --- a/.nvme-cli.metadata +++ b/.nvme-cli.metadata @@ -1 +1 @@ -1b66c5cb0d83948557c431157130565f1710b665 SOURCES/nvme-cli-2.2.1.tar.gz +01d2a5755d0d251eafeeefad27e739353f9e0f12 SOURCES/nvme-cli-2.6.tar.gz diff --git a/SOURCES/0001-udev-rules-set-ctrl_loss_tmo-to-1-for-ONTAP-NVMe-TCP.patch b/SOURCES/0001-udev-rules-set-ctrl_loss_tmo-to-1-for-ONTAP-NVMe-TCP.patch new file mode 100644 index 0000000..327cc85 --- /dev/null +++ b/SOURCES/0001-udev-rules-set-ctrl_loss_tmo-to-1-for-ONTAP-NVMe-TCP.patch @@ -0,0 +1,29 @@ +From 0782167f3a6709df232b746cdfa2a036c6207f7f Mon Sep 17 00:00:00 2001 +From: Martin George +Date: Tue, 3 Oct 2023 16:05:23 +0530 +Subject: [PATCH] udev-rules: set ctrl_loss_tmo to -1 for ONTAP NVMe/TCP + +Setting ctrl_loss_tmo to -1 for ONTAP NVMe/TCP controllers would enable +indefinite reconnect attempts during a path loss and help avoid purging +the path on the host, which otherwise may lead to mounted fs read-only +behavior. So add a rule towards enabling the same. + +Signed-off-by: Martin George +--- + nvmf-autoconnect/udev-rules/71-nvmf-iopolicy-netapp.rules.in | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/nvmf-autoconnect/udev-rules/71-nvmf-iopolicy-netapp.rules.in b/nvmf-autoconnect/udev-rules/71-nvmf-iopolicy-netapp.rules.in +index 299fe2251418..99b6a8ba0bf8 100644 +--- a/nvmf-autoconnect/udev-rules/71-nvmf-iopolicy-netapp.rules.in ++++ b/nvmf-autoconnect/udev-rules/71-nvmf-iopolicy-netapp.rules.in +@@ -1,3 +1,6 @@ + # Enable round-robin for NetApp ONTAP and NetApp E-Series + ACTION=="add", SUBSYSTEM=="nvme-subsystem", ATTR{subsystype}=="nvm", ATTR{model}=="NetApp ONTAP Controller", ATTR{iopolicy}="round-robin" + ACTION=="add", SUBSYSTEM=="nvme-subsystem", ATTR{subsystype}=="nvm", ATTR{model}=="NetApp E-Series", ATTR{iopolicy}="round-robin" ++ ++# Set ctrl_loss_tmo to -1 for NetApp ONTAP NVMe/TCP ++ACTION!="remove", SUBSYSTEM=="nvme", KERNEL=="nvme*", ATTR{transport}=="tcp", ATTR{model}=="NetApp ONTAP Controller", ATTR{ctrl_loss_tmo}="-1" +-- +2.39.3 + diff --git a/SOURCES/0002-udev-rules-rename-netapp-udev-rule.patch b/SOURCES/0002-udev-rules-rename-netapp-udev-rule.patch new file mode 100644 index 0000000..33650fb --- /dev/null +++ b/SOURCES/0002-udev-rules-rename-netapp-udev-rule.patch @@ -0,0 +1,50 @@ +From 748a9ac050fb443b1204d06ce3b5b129b6a8afe2 Mon Sep 17 00:00:00 2001 +From: Martin George +Date: Thu, 5 Oct 2023 12:12:46 +0530 +Subject: [PATCH] udev-rules: rename netapp udev rule + +Rename 71-nvmf-iopolicy-netapp.rules.in to 71-nvmf-netapp.rules.in +so as to make the name generic, since this not only sets the +iopolicy here but also modifies the ctrl_loss_tmo. + +Signed-off-by: Martin George +--- + meson.build | 2 +- + nvme.spec.in | 2 +- + ...71-nvmf-iopolicy-netapp.rules.in => 71-nvmf-netapp.rules.in} | 0 + 3 files changed, 2 insertions(+), 2 deletions(-) + rename nvmf-autoconnect/udev-rules/{71-nvmf-iopolicy-netapp.rules.in => 71-nvmf-netapp.rules.in} (100%) + +diff --git a/meson.build b/meson.build +index 3d3fb08541ff..310ba1f83400 100644 +--- a/meson.build ++++ b/meson.build +@@ -236,7 +236,7 @@ endforeach + + udev_files = [ + '70-nvmf-autoconnect.rules', +- '71-nvmf-iopolicy-netapp.rules', ++ '71-nvmf-netapp.rules', + ] + + foreach file : udev_files +diff --git a/nvme.spec.in b/nvme.spec.in +index fe4675a7bb0b..3eab9ff030ff 100644 +--- a/nvme.spec.in ++++ b/nvme.spec.in +@@ -31,7 +31,7 @@ touch %{buildroot}@SYSCONFDIR@/nvme/hostid + @SYSCONFDIR@/nvme/discovery.conf + %ghost @SYSCONFDIR@/nvme/config.json + @UDEVRULESDIR@/70-nvmf-autoconnect.rules +-@UDEVRULESDIR@/71-nvmf-iopolicy-netapp.rules ++@UDEVRULESDIR@/71-nvmf-netapp.rules + @DRACUTRILESDIR@/70-nvmf-autoconnect.conf + @SYSTEMDDIR@/nvmf-connect@.service + @SYSTEMDDIR@/nvmefc-boot-connections.service +diff --git a/nvmf-autoconnect/udev-rules/71-nvmf-iopolicy-netapp.rules.in b/nvmf-autoconnect/udev-rules/71-nvmf-netapp.rules.in +similarity index 100% +rename from nvmf-autoconnect/udev-rules/71-nvmf-iopolicy-netapp.rules.in +rename to nvmf-autoconnect/udev-rules/71-nvmf-netapp.rules.in +-- +2.39.3 + diff --git a/SOURCES/0003-Revert-fabrics-Use-corresponding-hostid-when-hostnqn.patch b/SOURCES/0003-Revert-fabrics-Use-corresponding-hostid-when-hostnqn.patch new file mode 100644 index 0000000..fbb6d05 --- /dev/null +++ b/SOURCES/0003-Revert-fabrics-Use-corresponding-hostid-when-hostnqn.patch @@ -0,0 +1,92 @@ +From 5f872e9c1689078bf2c4e33108c1514da1a91497 Mon Sep 17 00:00:00 2001 +From: Maurizio Lombardi +Date: Mon, 13 Nov 2023 10:49:35 +0100 +Subject: [PATCH] Revert "fabrics: Use corresponding hostid when hostnqn is + generated" + +This reverts commit 7d1c18f581e489e0cedfd9991bc97a2f8239cf82. +--- + fabrics.c | 47 ++--------------------------------------------- + 1 file changed, 2 insertions(+), 45 deletions(-) + +diff --git a/fabrics.c b/fabrics.c +index 57ca927fce9a..f4fb63f0c555 100644 +--- a/fabrics.c ++++ b/fabrics.c +@@ -616,43 +616,6 @@ static int nvme_read_volatile_config(nvme_root_t r) + return ret; + } + +-char *nvmf_hostid_from_hostnqn(const char *hostnqn) +-{ +- const char *uuid; +- +- if (!hostnqn) +- return NULL; +- +- uuid = strstr(hostnqn, "uuid:"); +- if (!uuid) +- return NULL; +- +- return strdup(uuid + strlen("uuid:")); +-} +- +-void nvmf_check_hostid_and_hostnqn(const char *hostid, const char *hostnqn) +-{ +- char *hostid_from_file, *hostid_from_hostnqn; +- +- if (!hostid) +- return; +- +- hostid_from_file = nvmf_hostid_from_file(); +- if (hostid_from_file && strcmp(hostid_from_file, hostid)) { +- fprintf(stderr, "warning: use generated hostid instead of hostid file\n"); +- free(hostid_from_file); +- } +- +- if (!hostnqn) +- return; +- +- hostid_from_hostnqn = nvmf_hostid_from_hostnqn(hostnqn); +- if (hostid_from_hostnqn && strcmp(hostid_from_hostnqn, hostid)) { +- fprintf(stderr, "warning: use hostid which does not match uuid in hostnqn\n"); +- free(hostid_from_hostnqn); +- } +-} +- + int nvmf_discover(const char *desc, int argc, char **argv, bool connect) + { + char *subsysnqn = NVME_DISC_SUBSYS_NAME; +@@ -729,13 +692,10 @@ int nvmf_discover(const char *desc, int argc, char **argv, bool connect) + hostid_arg = hostid; + if (!hostnqn) + hostnqn = hnqn = nvmf_hostnqn_from_file(); +- if (!hostnqn) { ++ if (!hostnqn) + hostnqn = hnqn = nvmf_hostnqn_generate(); +- hostid = hid = nvmf_hostid_from_hostnqn(hostnqn); +- } + if (!hostid) + hostid = hid = nvmf_hostid_from_file(); +- nvmf_check_hostid_and_hostnqn(hostid, hostnqn); + h = nvme_lookup_host(r, hostnqn, hostid); + if (!h) { + ret = ENOMEM; +@@ -946,13 +906,10 @@ int nvmf_connect(const char *desc, int argc, char **argv) + + if (!hostnqn) + hostnqn = hnqn = nvmf_hostnqn_from_file(); +- if (!hostnqn) { ++ if (!hostnqn) + hostnqn = hnqn = nvmf_hostnqn_generate(); +- hostid = hid = nvmf_hostid_from_hostnqn(hostnqn); +- } + if (!hostid) + hostid = hid = nvmf_hostid_from_file(); +- nvmf_check_hostid_and_hostnqn(hostid, hostnqn); + h = nvme_lookup_host(r, hostnqn, hostid); + if (!h) { + errno = ENOMEM; +-- +2.39.3 + diff --git a/SOURCES/0004-nvme-Fixed-segmentation-fault-when-getting-host-init.patch b/SOURCES/0004-nvme-Fixed-segmentation-fault-when-getting-host-init.patch new file mode 100644 index 0000000..0029be0 --- /dev/null +++ b/SOURCES/0004-nvme-Fixed-segmentation-fault-when-getting-host-init.patch @@ -0,0 +1,29 @@ +From 2f30d87d5c258fd97f78b0705bb92519d8a2498d Mon Sep 17 00:00:00 2001 +From: "da Cunha, Leonardo" +Date: Wed, 11 Oct 2023 09:01:44 -0700 +Subject: [PATCH] nvme: Fixed segmentation fault when getting host initiated + telemetry + +Signed-off-by: leonardo.da.cunha +--- + nvme.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/nvme.c b/nvme.c +index b9e56a48f0a5..73d74afdfd73 100644 +--- a/nvme.c ++++ b/nvme.c +@@ -851,6 +851,10 @@ static int __get_telemetry_log_host(struct nvme_dev *dev, + _cleanup_free_ struct nvme_telemetry_log *log = NULL; + int err; + ++ log = nvme_alloc(sizeof(*log)); ++ if (!log) ++ return -errno; ++ + err = nvme_cli_get_log_telemetry_host(dev, 0, + NVME_LOG_TELEM_BLOCK_SIZE, + log); +-- +2.39.3 + diff --git a/SPECS/nvme-cli.spec b/SPECS/nvme-cli.spec index 04e4c83..f51199a 100644 --- a/SPECS/nvme-cli.spec +++ b/SPECS/nvme-cli.spec @@ -2,21 +2,26 @@ #%%global shortcommit0 %%(c=%%{commit0}; echo ${c:0:7}) Name: nvme-cli -Version: 2.2.1 -Release: 2%{?dist} +Version: 2.6 +Release: 5%{?dist} Summary: NVMe management command line interface -License: GPLv2+ +License: GPL-2.0-only URL: https://github.com/linux-nvme/nvme-cli Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz -BuildRequires: meson >= 0.48.0 +Patch0: 0001-udev-rules-set-ctrl_loss_tmo-to-1-for-ONTAP-NVMe-TCP.patch +Patch1: 0002-udev-rules-rename-netapp-udev-rule.patch +Patch2: 0003-Revert-fabrics-Use-corresponding-hostid-when-hostnqn.patch +Patch3: 0004-nvme-Fixed-segmentation-fault-when-getting-host-init.patch + +BuildRequires: meson >= 0.50.0 BuildRequires: gcc gcc-c++ BuildRequires: libuuid-devel BuildRequires: systemd-devel BuildRequires: systemd-rpm-macros BuildRequires: zlib-devel -BuildRequires: libnvme-devel >= 1.2 +BuildRequires: libnvme-devel >= 1.6-1 BuildRequires: json-c-devel >= 0.14 BuildRequires: asciidoc BuildRequires: xmlto @@ -30,6 +35,11 @@ nvme-cli provides NVM-Express user space tooling for Linux. #%%setup -qn %%{name}-%%{commit0} %setup -q +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 + %build %meson -Dudevrulesdir=%{_udevrulesdir} -Dsystemddir=%{_unitdir} -Ddocs=all -Ddocs-build=true -Dhtmldir=%{_pkgdocdir} %meson_build @@ -37,12 +47,8 @@ nvme-cli provides NVM-Express user space tooling for Linux. %install %meson_install -# hostid and hostnqn are supposed to be unique per machine. We obviously -# can't package them. -#rm -f %{buildroot}%{_sysconfdir}/nvme/hostid -#rm -f %{buildroot}%{_sysconfdir}/nvme/hostnqn - # Do not install the dracut rule yet. See rhbz 1742764 +# Do we want to keep this here? Now that we have boot support for nvme/fc + tcp? rm -f %{buildroot}/usr/lib/dracut/dracut.conf.d/70-nvmf-autoconnect.conf # Move html docs into the right place @@ -52,48 +58,94 @@ rm -rf %{buildroot}%{_pkgdocdir}/nvme %files %license LICENSE %doc README.md -%doc %{_pkgdocdir} +%doc %{_pkgdocdir}/* %{_sbindir}/nvme %{_mandir}/man1/nvme*.gz %{_datadir}/bash-completion/completions/nvme %{_datadir}/zsh/site-functions/_nvme %dir %{_sysconfdir}/nvme -%{_sysconfdir}/nvme/discovery.conf +%config(noreplace) %{_sysconfdir}/nvme/discovery.conf %{_unitdir}/nvmefc-boot-connections.service %{_unitdir}/nvmf-autoconnect.service %{_unitdir}/nvmf-connect.target %{_unitdir}/nvmf-connect@.service %{_udevrulesdir}/70-nvmf-autoconnect.rules -%{_udevrulesdir}/71-nvmf-iopolicy-netapp.rules +%{_udevrulesdir}/71-nvmf-netapp.rules # Do not install the dracut rule yet. See rhbz 1742764 +# Is this still true? Now that we support nvme-of boot, do we want to install this file? # /usr/lib/dracut/dracut.conf.d/70-nvmf-autoconnect.conf %post if [ $1 -eq 1 ] || [ $1 -eq 2 ]; then if [ ! -s %{_sysconfdir}/nvme/hostnqn ]; then - echo $(nvme gen-hostnqn) > %{_sysconfdir}/nvme/hostnqn + echo $(nvme gen-hostnqn) > %{_sysconfdir}/nvme/hostnqn fi if [ ! -s %{_sysconfdir}/nvme/hostid ]; then - uuidgen > %{_sysconfdir}/nvme/hostid + echo $(nvme show-hostnqn | sed 's/^.*uuid://') > %{_sysconfdir}/nvme/hostid fi - # apply udev and systemd changes that we did - if [ $1 -eq 1 ]; then - systemctl enable nvmefc-boot-connections - fi - systemctl daemon-reload - udevadm control --reload-rules && udevadm trigger - exit 0 + # apply udev and systemd changes that we did + if [ $1 -eq 1 ]; then + systemctl enable nvmefc-boot-connections + fi + systemctl daemon-reload + udevadm control --reload-rules && udevadm trigger + exit 0 fi %changelog +* Thu Feb 22 2024 Maurizio Lombardi - 2.6-5 +- Fix for RHEL-13107 + +* Mon Nov 13 2023 Maurizio Lombardi - 2.6-4 +- Fix for RHEL-16216 (revert 1:1 mapping between hostnqn and hostid) + +* Wed Nov 08 2023 Maurizio Lombardi - 2.6-3 +- Fixes for RHEL-12566 + +* Mon Nov 06 2023 Maurizio Lombardi - 2.6-2 +- Rebuild for side-tag + +* Tue Oct 31 2023 Maurizio Lombardi - 2.6-1 +- Update to version 2.6 + +* Mon Aug 21 2023 John Meneghini - 2.4-10 +- JIRA: https://issues.redhat.com/browse/RHEL-1492 + +* Thu Aug 10 2023 John Meneghini - 2.4-9 +- JIRA: https://issues.redhat.com/browse/RHEL-1147 + +* Mon Jul 17 2023 John Meneghini - 2.4-8 +- Fix BZ#2223436 + +* Wed Jun 14 2023 Maurizio Lombardi - 2.4-7 +- Fix BZ#2210656 + +* Tue May 30 2023 Maurizio Lombardi - 2.4-6 +- Rebuild for #2208399 + +* Thu May 25 2023 Maurizio Lombardi - 2.4-5 +- Fix SSTAT print (BZ2208399) + +* Tue May 16 2023 Maurizio Lombardi - 2.4-4 +- Add support to NBFT (BZ2188518) + +* Fri May 12 2023 Maurizio Lombardi - 2.4-3 +- Fix a warning when building the package BZ2195897 + +* Wed May 03 2023 Maurizio Lombardi - 2.4-2 +- Fix a bogus changelog date BZ2186074 + +* Mon Apr 03 2023 Maurizio Lombardi - 2.4-1 +- Update to version v2.4 + * Thu Nov 10 2022 Maurizio Lombardi - 2.1.2-2 - Do not re-enable nvmefc-boot-connections when the package gets updated * Mon Sep 26 2022 Maurizio Lombardi - 2.1.2-1 - Update to version v2.1.2 -* Fri Aug 29 2022 Maurizio Lombardi - 2.0-4 +* Mon Aug 29 2022 Maurizio Lombardi - 2.0-4 - Fix BZ2104945 * Fri Jul 15 2022 Maurizio Lombardi - 2.0-3