device-mapper-multipath-0.8.7-30

Add 0120-multipath-tools-fix-multipath-ll-bug-for-Native-NVME.patch
  * Fixes RHEL-28068
Add 0121-multipathd-set-reply-length-to-zero-for-NULL-replies.patch
  * Fixes RHEL-44569
Resolves: RHEL-28068
Resolves: RHEL-44569
This commit is contained in:
Benjamin Marzinski 2024-07-30 19:27:04 -04:00
parent 9ae3e98286
commit 4512f00ef1
3 changed files with 143 additions and 1 deletions

View File

@ -0,0 +1,103 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: chengjike <chengjike.cheng@huawei.com>
Date: Fri, 8 Oct 2021 20:24:49 +0800
Subject: [PATCH] multipath-tools: fix "multipath -ll" bug for Native NVME
Multipath devices
After "Native NVME Multipath" is configured,
the content displayed is incorrect when you run "multipath -ll" command.
Each NVME devices have the same path name. For example:
[root@localhost home]# multipath -ll
eui.710032e8fb22a86c24a52c1000000db8 [nvme]:nvme1n1 NVMe,Huawei-XSG1,1000001
size=10485760 features='n/a' hwhandler='ANA' wp=rw
|-+- policy='n/a' prio=50 status=optimized
| `- 1:4:1 nvme1c4n1 0:0 n/a optimized live
`-+- policy='n/a' prio=50 status=optimized
`- 1:9:1 nvme1c9n1 0:0 n/a optimized live
eui.710032e8fb22a86b24a52c7c00000db7 [nvme]:nvme1n2 NVMe,Huawei-XSG1,1000001
size=10485760 features='n/a' hwhandler='ANA' wp=rw
|-+- policy='n/a' prio=50 status=optimized
| `- 1:4:1 nvme1c4n1 0:0 n/a optimized live
`-+- policy='n/a' prio=50 status=optimized
`- 1:9:1 nvme1c9n1 0:0 n/a optimized live
[root@localhost home]#
The logical paths of "nvme1n1" and "nvme1n2" are both "nvme1c4n1" and "nvme1c9n1".
So when multipath-tools aggregates disks, use "nvme_ns_head->instance" for matching.
such as ,Use "b" in "nvmeanb" string to match "z" in "nvmexcynz"(a,b,x,y,z can be any number),
and if "b" and "z" are the same, they are related.
Signed-off-by: chengjike <chengjike.cheng@huawei.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/foreign/nvme.c | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/libmultipath/foreign/nvme.c b/libmultipath/foreign/nvme.c
index 23355ca5..76b57283 100644
--- a/libmultipath/foreign/nvme.c
+++ b/libmultipath/foreign/nvme.c
@@ -530,14 +530,18 @@ static int _dirent_controller(const struct dirent *di)
/* Find the block device for a given nvme controller */
struct udev_device *get_ctrl_blkdev(const struct context *ctx,
- struct udev_device *ctrl)
+ struct udev_device *ctrl, const char *ctrl_name)
{
+ int ctrl_num, ns_num;
struct udev_list_entry *item;
struct udev_device *blkdev = NULL;
struct udev_enumerate *enm = udev_enumerate_new(ctx->udev);
const char *devtype;
- if (enm == NULL)
+ if (enm == NULL || ctrl_name == NULL)
+ return NULL;
+
+ if (sscanf(ctrl_name, "nvme%dn%d", &ctrl_num, &ns_num) != 2)
return NULL;
pthread_cleanup_push(_udev_enumerate_unref, enm);
@@ -555,6 +559,8 @@ struct udev_device *get_ctrl_blkdev(const struct context *ctx,
item != NULL;
item = udev_list_entry_get_next(item)) {
struct udev_device *tmp;
+ const char *name = NULL ;
+ int m, n, l;
tmp = udev_device_new_from_syspath(ctx->udev,
udev_list_entry_get_name(item));
@@ -562,11 +568,19 @@ struct udev_device *get_ctrl_blkdev(const struct context *ctx,
continue;
devtype = udev_device_get_devtype(tmp);
- if (devtype && !strcmp(devtype, "disk")) {
+ if (devtype == NULL || strcmp(devtype, "disk")) {
+ udev_device_unref(tmp);
+ continue;
+ }
+
+ name = udev_device_get_sysname(tmp);
+ if (name != NULL &&
+ sscanf(name, "nvme%dc%dn%d", &m, &n, &l) == 3 &&
+ l == ns_num) {
blkdev = tmp;
break;
- } else
- udev_device_unref(tmp);
+ }
+ udev_device_unref(tmp);
}
if (blkdev == NULL)
@@ -679,7 +693,7 @@ static void _find_controllers(struct context *ctx, struct nvme_map *map)
}
pthread_cleanup_push(_udev_device_unref, ctrl);
- udev = get_ctrl_blkdev(ctx, ctrl);
+ udev = get_ctrl_blkdev(ctx, ctrl, udev_device_get_sysname(map->udev));
/*
* We give up the reference to the nvme device here and get
* it back from the child below.

View File

@ -0,0 +1,29 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Wed, 24 Jul 2024 16:38:52 -0400
Subject: [PATCH] multipathd: set reply length to zero for NULL replies
The multipathd cli handlers add one to the reply length to account for
NULL byte, but if the reply is NULL, there is no NULL by to account for,
and len should be 0, so that mutipathd replies to clients with a
default reply.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipathd/cli.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/multipathd/cli.c b/multipathd/cli.c
index eb2e8c1d..03ad0d64 100644
--- a/multipathd/cli.c
+++ b/multipathd/cli.c
@@ -496,6 +496,9 @@ parse_cmd (char * cmd, char ** reply, int * len, void * data, int timeout )
r = h->fn(cmdvec, reply, len, data);
free_keys(cmdvec);
+ if (*reply == NULL)
+ *len = 0;
+
return r;
}

View File

@ -1,6 +1,6 @@
Name: device-mapper-multipath
Version: 0.8.7
Release: 29%{?dist}
Release: 30%{?dist}
Summary: Tools to manage multipath devices using device-mapper
License: GPLv2
URL: http://christophe.varoqui.free.fr/
@ -129,6 +129,8 @@ Patch0116: 0116-multipathd-Stop-double-counting-map-failures-for-no_.patch
Patch0117: 0117-multipath-tools-man-pages-add-missing-multipathd-com.patch
Patch0118: 0118-libmultipath-change-the-vend-prod-rev-printing.patch
Patch0119: 0119-multipath-tools-man-pages-Add-format-wildcard-descri.patch
Patch0120: 0120-multipath-tools-fix-multipath-ll-bug-for-Native-NVME.patch
Patch0121: 0121-multipathd-set-reply-length-to-zero-for-NULL-replies.patch
# runtime
@ -332,6 +334,14 @@ fi
%{_pkgconfdir}/libdmmp.pc
%changelog
* Tue Jul 30 2024 Benjamin Marzinski <bmarzins@redhat.com> - 0.8.7-30
- Add 0120-multipath-tools-fix-multipath-ll-bug-for-Native-NVME.patch
* Fixes RHEL-28068
- Add 0121-multipathd-set-reply-length-to-zero-for-NULL-replies.patch
* Fixes RHEL-44569
- Resolves: RHEL-28068
- Resolves: RHEL-44569
* Tue May 21 2024 Benjamin Marzinski <bmarzins@redhat.com> - 0.8.7-29
- Add 0110-libmultipath-keep-track-of-queueing-state-in-feature.patch
- Add 0111-libmultipath-export-partmap_in_use.patch