Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
fa7b26e256
!220 multipathd: don't print so many add map messages
From: @kouwq 
Reviewed-by: @swf504 
Signed-off-by: @swf504
2024-10-12 08:11:24 +00:00
kouwenqi
e6a1e6ede4 multipathd: don't print so many add map messages
Whenever a dm device gets a change uevent, multipathd prints an add map
message.  This can get confusing for users, so change that message to
not print at the default log level.

commit b429df90b6db4d9544d01d5cd052e83710acaab0 in upstream made the change.
However 0008-multipathd-disable-queueing-for-recreated-map-in-uev.patch
changed it back.
Now fix it.
2024-09-27 13:52:50 +08:00
openeuler-ci-bot
58e2824056
!214 sync patch multipath-display-the-correct-configuration-when-dum.patch with community
From: @kouwq 
Reviewed-by: @swf504 
Signed-off-by: @swf504
2024-08-31 01:39:15 +00:00
openeuler-ci-bot
4142437018
!206 【轻量级PR】: Added 'Buildarch: noarch'to the help subpaackage
From: @Destiny_zhuohua 
Reviewed-by: @swf504 
Signed-off-by: @swf504
2024-08-27 01:52:09 +00:00
kouwenqi
4cdee0e8e5 sync patch50 with community 2024-08-26 12:04:50 +08:00
zhangjiaming
162cf66748 Added 'Buildarch: noarch' to the help subpackage 2024-08-21 10:19:02 +08:00
openeuler-ci-bot
4444f6328e
!200 libmultipath: limit paths that can get wwid from environment
From: @kouwq 
Reviewed-by: @swf504 
Signed-off-by: @swf504
2024-08-12 12:39:41 +00:00
Kou Wenqi
586476ba6b libmultipath: limit paths that can get wwid from environment
Currently, whenever getting the uid_attribute from the udev database
fails, multipath will try to get it from the environment variables. This
normally isn't a problem, since either multipath -u is getting called
from a uevent and the environment will have the correct value in that
variable, or something else is being run and that variable won't be set.
However, when find_multipaths is configured to "smart", this causes
problems. For maybe devices, multipath needs to get the WWIDs of all the
other block devices, to see if they match the maybe device wwid.  If one
of those devices doesn't have uid_attribute set in its udev database,
multipath will fall back to checking the environment for it, and it will
find that variable set to the WWID of the maybe device that this uevent
is for.  This means that all devices with no WWID will end up appearing
to have the same WWID as the maybe device, causing multipath to
incorrectly claim it.
2024-08-08 14:24:46 +08:00
openeuler-ci-bot
35ad6d85c1
!199 multipath: return failure on an invalid remove command
From: @kouwq 
Reviewed-by: @swf504 
Signed-off-by: @swf504
2024-08-08 01:09:30 +00:00
Kou Wenqi
09e7eb51d9 multipath: return failure on an invalid remove command
When "multipath -f" is run on a device that doesn't exist or isn't a
multipath device, the command will not remove any device, but it will
still return success.  Multiple functions rely on _dm_flush_map()
returning success when called with name that doesn't match any
multipath device. So before calling _dm_flush_map(), call dm_is_mpath(),
to check if the device exists and is a multipath device, and return
failure if it's not.
2024-08-07 14:58:26 +08:00
5 changed files with 185 additions and 36 deletions

View File

@ -1,54 +1,44 @@
From d03a21a3474993cdf95c73da7ea70308659c3d70 Mon Sep 17 00:00:00 2001
From 0802e9dfd27e2333615e8068d7fa55a614bef92e Mon Sep 17 00:00:00 2001
From: Kou Wenqi <kouwenqi@kylinos.cn>
Date: Mon, 5 Aug 2024 14:35:06 +0800
Subject: [PATCH] multipath: display the correct configuration when dumpping
Date: Tue, 13 Aug 2024 10:12:36 +0800
Subject: [PATCH] multipath: display the correct configuration when dumping
config
"multipath -t" and "multipath -T" might show the wrong
multipathd configuration items "retrigger_tries" and
"force_sync". Make sure they don't.
Signed-off-by: Kou Wenqi <kouwenqi@kylinos.cn>
Reviewed-by: Martin Wilck <mwilck@suse.com>
---
multipath/main.c | 8 ++++++++
1 file changed, 8 insertions(+)
multipath/main.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/multipath/main.c b/multipath/main.c
index 3c5a70e..f52430f 100644
index 65f2949..4853d17 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -866,6 +866,8 @@ main (int argc, char *argv[])
char *dev = NULL;
struct config *conf;
int retries = -1;
+ int retrigger_tries_ori;
+ int force_sync_ori;
udev = udev_new();
logsink = 0;
@@ -873,7 +875,9 @@ main (int argc, char *argv[])
@@ -875,8 +875,6 @@ main (int argc, char *argv[])
if (!conf)
exit(RTVL_FAIL);
multipath_conf = conf;
+ retrigger_tries_ori = conf->retrigger_tries;
conf->retrigger_tries = 0;
+ force_sync_ori = conf->force_sync;
conf->force_sync = 1;
- conf->retrigger_tries = 0;
- conf->force_sync = 1;
while ((arg = getopt(argc, argv, ":adcChl::FfM:v:p:b:BrR:itTquUwW")) != EOF ) {
switch(arg) {
@@ -944,10 +948,14 @@ main (int argc, char *argv[])
conf->find_multipaths = FIND_MULTIPATHS_GREEDY;
break;
case 't':
+ conf->retrigger_tries = retrigger_tries_ori;
+ conf->force_sync = force_sync_ori;
r = dump_config(conf, NULL, NULL) ? RTVL_FAIL : RTVL_OK;
goto out_free_config;
case 'T':
cmd = CMD_DUMP_CONFIG;
+ conf->retrigger_tries = retrigger_tries_ori;
+ conf->force_sync = force_sync_ori;
break;
case 'h':
usage(argv[0]);
case 1: printf("optarg : %s\n",optarg);
@@ -1017,6 +1015,11 @@ main (int argc, char *argv[])
libmp_udev_set_sync_support(1);
+ if (cmd != CMD_DUMP_CONFIG) {
+ conf->retrigger_tries = 0;
+ conf->force_sync = 1;
+ }
+
if (init_checkers(conf->multipath_dir)) {
condlog(0, "failed to initialize checkers");
goto out;
--
2.27.0

View File

@ -0,0 +1,38 @@
From 774b5ad984a9c4f1d8d869d804ad1dc35dab7d8b Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Wed, 30 Mar 2022 15:14:56 -0500
Subject: [PATCH] multipath: return failure on an invalid remove command
When "multipath -f" is run on a device that doesn't exist or isn't a
multipath device, the command will not remove any device, but it will
still return success. Multiple functions rely on _dm_flush_map()
returning success when called with name that doesn't match any
multipath device. So before calling _dm_flush_map(), call dm_is_mpath(),
to check if the device exists and is a multipath device, and return
failure if it's not.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Martin Wilck <mwilck@suse.com
---
multipath/main.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/multipath/main.c b/multipath/main.c
index f52430f..008de0b 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -1088,6 +1088,11 @@ main (int argc, char *argv[])
retries = conf->remove_retries;
if (conf->remove == FLUSH_ONE) {
if (dev_type == DEV_DEVMAP) {
+ if (dm_is_mpath(dev) != 1) {
+ condlog(0, "%s is not a multipath device", dev);
+ r = RTVL_FAIL;
+ goto out;
+ }
r = dm_suspend_and_flush_map(dev, retries) ?
RTVL_FAIL : RTVL_OK;
} else
--
2.27.0

View File

@ -0,0 +1,69 @@
From 694a29d909268868eb2d855303a0420c2baeffda Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Thu, 9 Feb 2023 11:28:31 -0600
Subject: [PATCH] libmultipath: limit paths that can get wwid from environment
Currently, whenever getting the uid_attribute from the udev database
fails, multipath will try to get it from the environment variables. This
normally isn't a problem, since either multipath -u is getting called
from a uevent and the environment will have the correct value in that
variable, or something else is being run and that variable won't be set.
However, when find_multipaths is configured to "smart", this causes
problems. For maybe devices, multipath needs to get the WWIDs of all the
other block devices, to see if they match the maybe device wwid. If one
of those devices doesn't have uid_attribute set in its udev database,
multipath will fall back to checking the environment for it, and it will
find that variable set to the WWID of the maybe device that this uevent
is for. This means that all devices with no WWID will end up appearing
to have the same WWID as the maybe device, causing multipath to
incorrectly claim it.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
---
libmultipath/discovery.c | 2 +-
libmultipath/structs.h | 1 +
multipath/main.c | 2 ++
3 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index f1de837..1e3847f 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -2000,7 +2000,7 @@ get_udev_uid(struct path * pp, char *uid_attribute, struct udev_device *udev)
const char *value;
value = udev_device_get_property_value(udev, uid_attribute);
- if (!value || strlen(value) == 0)
+ if ((!value || strlen(value) == 0) && pp->can_use_env_uid)
value = getenv(uid_attribute);
if (value && strlen(value)) {
len = strlcpy(pp->wwid, value, WWID_SIZE);
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
index deced7d..3e73d80 100644
--- a/libmultipath/structs.h
+++ b/libmultipath/structs.h
@@ -288,6 +288,7 @@ struct path {
int find_multipaths_timeout;
int marginal;
int vpd_vendor_id;
+ bool can_use_env_uid;
/* configlet pointers */
vector hwe;
struct gen_path generic_path;
diff --git a/multipath/main.c b/multipath/main.c
index 008de0b..5f357b5 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -677,6 +677,8 @@ check_path_valid(const char *name, struct config *conf, bool is_uevent)
pp = alloc_path();
if (!pp)
return RTVL_FAIL;
+ if (is_uevent)
+ pp->can_use_env_uid = true;
r = is_path_valid(name, conf, pp, is_uevent);
if (r <= PATH_IS_ERROR || r >= PATH_MAX_VALID_RESULT)
--
2.27.0

View File

@ -0,0 +1,33 @@
From 5353a851b4ba8a356bf02bf3f1bb903025dbc664 Mon Sep 17 00:00:00 2001
From: Kou Wenqi <kouwenqi@kylinos.cn>
Date: Fri, 27 Sep 2024 13:37:25 +0800
Subject: [PATCH] multipathd: don't print so many add map messages
Whenever a dm device gets a change uevent, multipathd prints an add map
message. This can get confusing for users, so change that message to
not print at the default log level.
commit b429df90b6db4d9544d01d5cd052e83710acaab0 in upstream made the change.
However 0008-multipathd-disable-queueing-for-recreated-map-in-uev.patch
changed it back.
Now fix it.
---
multipathd/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/multipathd/main.c b/multipathd/main.c
index 53a7fa2..6a88b10 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -674,7 +674,7 @@ uev_add_map (struct uevent * uev, struct vectors * vecs)
char *alias;
int major = -1, minor = -1, rc;
- condlog(2, "%s: add map (uevent)", uev->kernel);
+ condlog(3, "%s: add map (uevent)", uev->kernel);
alias = uevent_get_dm_name(uev);
if (!alias) {
condlog(3, "%s: No DM_NAME in uevent", uev->kernel);
--
2.27.0

View File

@ -2,7 +2,7 @@
Name: multipath-tools
Version: 0.8.4
Release: 26
Release: 31
Summary: Tools to manage multipath devices with the device-mapper
License: GPL-2.0-or-later and LGPL-2.0-only
URL: http://christophe.varoqui.free.fr/
@ -60,6 +60,9 @@ Patch47: 0047-libmultipath-sysfs_set_scsi_tmo-do-nothing-for-ACT_D.patch
Patch48: 0048-multipath.conf.5-fix-documentation-for-find_multipat.patch
Patch49: 0049-multipath.conf.5-fix-the-description-of-prio_args-fo.patch
Patch50: 0050-multipath-display-the-correct-configuration-when-dum.patch
Patch51: 0051-multipath-return-failure-on-an-invalid-remove-comman.patch
Patch52: 0052-libmultipath-limit-paths-that-can-get-wwid-from-envi.patch
Patch53: 0053-multipathd-don-t-print-so-many-add-map-messages.patch
BuildRequires: multipath-tools, libcmocka, libcmocka-devel
BuildRequires: gcc, libaio-devel, userspace-rcu-devel, device-mapper-devel >= 1.02.89
@ -106,6 +109,7 @@ that are %{name}'s libbmpathpersist and libmpathcmd libraries.
%package help
Summary: Including man files for multipath-tools.
Requires: man
Buildarch: noarch
Provides: device-mapper-multipath-help
Obsoletes: device-mapper-multipath-help
%description help
@ -207,6 +211,21 @@ fi
%changelog
* Fri Sep 27 2024 kouwenqi <kouwenqi@kylinos.cn> - 0.8.4-31
- multipathd: don't print so many add map messages
* Tue Aug 27 2024 kouwenqi <kouwenqi@kylinos.cn> - 0.8.4-30
- sync patch50 with community
* Wed Aug 21 2024 Jiaming Zhang <zhangjiaming@cqsoftware.com.cn> - 0.8.4-29
- Added 'Buildarch:noarch' to the help subpackage
* Thu Aug 8 2024 kouwenqi <kouwenqi@kylinos.cn> - 0.8.4-28
- libmultipath: limit paths that can get wwid from environment
* Wed Aug 7 2024 kouwenqi <kouwenqi@kylinos.cn> - 0.8.4-27
- multipath: return failure on an invalid remove command
* Mon Aug 5 2024 kouwenqi <kouwenqi@kylinos.cn> - 0.8.4-26
- multipath: display the correct configuration when dumpping config