!203 [sync] PR-201: libmultipath: limit paths that can get wwid from environment
From: @openeuler-sync-bot Reviewed-by: @swf504 Signed-off-by: @swf504
This commit is contained in:
commit
2e152876b1
@ -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 fb20308..ea0ceef 100644
|
||||||
|
--- a/libmultipath/discovery.c
|
||||||
|
+++ b/libmultipath/discovery.c
|
||||||
|
@@ -2145,7 +2145,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 ec12660..5fb131b 100644
|
||||||
|
--- a/libmultipath/structs.h
|
||||||
|
+++ b/libmultipath/structs.h
|
||||||
|
@@ -325,6 +325,7 @@ struct path {
|
||||||
|
int marginal;
|
||||||
|
int vpd_vendor_id;
|
||||||
|
int recheck_wwid;
|
||||||
|
+ 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 2ab302f..7ecbe51 100644
|
||||||
|
--- a/multipath/main.c
|
||||||
|
+++ b/multipath/main.c
|
||||||
|
@@ -607,6 +607,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
|
||||||
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
#needsrootforbuild
|
#needsrootforbuild
|
||||||
Name: multipath-tools
|
Name: multipath-tools
|
||||||
Version: 0.8.7
|
Version: 0.8.7
|
||||||
Release: 15
|
Release: 16
|
||||||
Summary: Tools to manage multipath devices with the device-mapper
|
Summary: Tools to manage multipath devices with the device-mapper
|
||||||
License: GPL-2.0-or-later and LGPL-2.0-only
|
License: GPL-2.0-or-later and LGPL-2.0-only
|
||||||
URL: http://christophe.varoqui.free.fr/
|
URL: http://christophe.varoqui.free.fr/
|
||||||
@ -41,6 +41,7 @@ Patch29: 0029-libmultipath-sysfs_set_scsi_tmo-do-nothing-for-ACT_D.patch
|
|||||||
Patch30: 0030-multipath.conf.5-fix-documentation-for-find_multipat.patch
|
Patch30: 0030-multipath.conf.5-fix-documentation-for-find_multipat.patch
|
||||||
Patch31: 0031-multipath.conf.5-fix-the-description-of-prio_args-fo.patch
|
Patch31: 0031-multipath.conf.5-fix-the-description-of-prio_args-fo.patch
|
||||||
Patch32: 0032-multipath-display-the-correct-configuration-when-dum.patch
|
Patch32: 0032-multipath-display-the-correct-configuration-when-dum.patch
|
||||||
|
Patch33: 0033-libmultipath-limit-paths-that-can-get-wwid-from-envi.patch
|
||||||
|
|
||||||
BuildRequires: multipath-tools, libcmocka, libcmocka-devel
|
BuildRequires: multipath-tools, libcmocka, libcmocka-devel
|
||||||
BuildRequires: gcc, libaio-devel, userspace-rcu-devel, device-mapper-devel >= 1.02.89
|
BuildRequires: gcc, libaio-devel, userspace-rcu-devel, device-mapper-devel >= 1.02.89
|
||||||
@ -188,6 +189,9 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Aug 8 2024 kouwenqi <kouwenqi@kylinos.cn> - 0.8.7-16
|
||||||
|
- libmultipath: limit paths that can get wwid from environment
|
||||||
|
|
||||||
* Mon Aug 5 2024 kouwenqi <kouwenqi@kylinos.cn> - 0.8.7-15
|
* Mon Aug 5 2024 kouwenqi <kouwenqi@kylinos.cn> - 0.8.7-15
|
||||||
- multipath: display the correct configuration when dumpping config
|
- multipath: display the correct configuration when dumpping config
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user