diff --git a/0003-Revert-fabrics-Use-corresponding-hostid-when-hostnqn.patch b/0003-Revert-fabrics-Use-corresponding-hostid-when-hostnqn.patch new file mode 100644 index 0000000..fbb6d05 --- /dev/null +++ b/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/nvme-cli.spec b/nvme-cli.spec index 81cecfd..653d14a 100644 --- a/nvme-cli.spec +++ b/nvme-cli.spec @@ -3,7 +3,7 @@ Name: nvme-cli Version: 2.6 -Release: 3%{?dist} +Release: 4%{?dist} Summary: NVMe management command line interface License: GPL-2.0-only @@ -12,6 +12,7 @@ Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz 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 BuildRequires: meson >= 0.50.0 BuildRequires: gcc gcc-c++ @@ -35,6 +36,7 @@ nvme-cli provides NVM-Express user space tooling for Linux. %patch0 -p1 %patch1 -p1 +%patch2 -p1 %build %meson -Dudevrulesdir=%{_udevrulesdir} -Dsystemddir=%{_unitdir} -Ddocs=all -Ddocs-build=true -Dhtmldir=%{_pkgdocdir} @@ -90,6 +92,9 @@ if [ $1 -eq 1 ] || [ $1 -eq 2 ]; then fi %changelog +* 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