nvme: set eds to true if controller supports 128 bit hostid

Resolves: RHEL-10433

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
This commit is contained in:
Maurizio Lombardi 2025-02-13 10:30:52 +01:00
parent 5cda8a4678
commit 45a411ab98
2 changed files with 61 additions and 1 deletions

View File

@ -0,0 +1,56 @@
From 7057e6c50639fb05d0997eaa6fac48ece3cb38bc Mon Sep 17 00:00:00 2001
From: Bryan Gurney <bgurney@redhat.com>
Date: Tue, 21 Jan 2025 12:20:34 -0500
Subject: [PATCH] nvme: set eds to true if controller supports 128 bit hostid
A controller that uses a 128-bit Host Identifier may result in the
"nvme resv-report" command failing with a "Host Identifier Inconsistent
Format" error that suggests the "simultaneous use of 64-bit and
128-bit Host Identifier values on different controllers".
This error can be avoided if the "--eds" option is used, to request
the extended data structure. However, the controller's ctratt
value indicates whether the Host Identifier is 64 bits or 128 bits.
Therefore, check the ctratt flag, and set eds to true if the
controller indicates a 128-bit Host Identifier.
Signed-off-by: Bryan Gurney <bgurney@redhat.com>
---
nvme.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/nvme.c b/nvme.c
index a65873b2..2ed4ee92 100644
--- a/nvme.c
+++ b/nvme.c
@@ -7740,6 +7740,7 @@ static int resv_report(int argc, char **argv, struct command *cmd, struct plugin
const char *eds = "request extended data structure";
_cleanup_free_ struct nvme_resv_status *status = NULL;
+ _cleanup_free_ struct nvme_id_ctrl *ctrl = NULL;
_cleanup_nvme_dev_ struct nvme_dev *dev = NULL;
nvme_print_flags_t flags;
int err, size;
@@ -7792,6 +7793,19 @@ static int resv_report(int argc, char **argv, struct command *cmd, struct plugin
size = (cfg.numd + 1) << 2;
+ ctrl = nvme_alloc(sizeof(*ctrl));
+ if (!ctrl)
+ return -ENOMEM;
+
+ err = nvme_cli_identify_ctrl(dev, ctrl);
+ if (err) {
+ nvme_show_error("identify-ctrl: %s", nvme_strerror(errno));
+ return -errno;
+ }
+
+ if (ctrl->ctratt & NVME_CTRL_CTRATT_128_ID)
+ cfg.eds = true;
+
status = nvme_alloc(size);
if (!status)
return -ENOMEM;
--
2.43.5

View File

@ -5,7 +5,7 @@
Name: nvme-cli
Version: 2.11
Release: 4%{?dist}
Release: 5%{?dist}
Summary: NVMe management command line interface
License: GPL-2.0-only
@ -21,6 +21,7 @@ Patch4: 0005-nvme-netapp-update-err-messages.patch
Patch5: 0006-netapp-smdev-remove-redundant-code.patch
Patch6: 0007-netapp-smdev-add-verbose-output.patch
Patch7: 0008-netapp-smdev-doc-add-verbose-details.patch
Patch8: 0009-nvme-set-eds-to-true-if-controller-supports-128-bit-.patch
BuildRequires: meson >= 0.50.0
BuildRequires: gcc gcc-c++
@ -105,6 +106,9 @@ if [ $1 -eq 1 ] || [ $1 -eq 2 ]; then
fi
%changelog
* Thu Feb 13 2025 Maurizio Lombardi <mlombard@redhat.com> - 2.11-5
- Fix for RHEL-10433
* Fri Jan 24 2025 Maurizio Lombardi <mlombard@redhat.com> - 2.11-4
- Add kernel-headers to BuildRequires (RHEL-70856)