RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1979470 - find_multipaths_timeout is overwritten by mpatchconf command
Summary: find_multipaths_timeout is overwritten by mpatchconf command
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: device-mapper-multipath
Version: 8.4
Hardware: All
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Ben Marzinski
QA Contact: Lin Li
URL:
Whiteboard:
Depends On:
Blocks: 1981594
TreeView+ depends on / blocked
 
Reported: 2021-07-06 07:07 UTC by Renaud Métrich
Modified: 2024-10-01 18:54 UTC (History)
8 users (show)

Fixed In Version: device-mapper-multipath-0.8.4-14.el8
Doc Type: Bug Fix
Doc Text:
Cause: mpathconf wasn't correctly checking that there was one or more spaces between paramter names and their values, leading it to treat the find_multipaths_timeout parameter the same as find_multipaths parameter Consequence: If find_multipaths_timeout was set, and mpathconf was used to modify find_multipaths, it would convert the find_multipaths_timeout line into an invalid line. Fix: When mpathconf checks the existing multipath.conf file for parameters, it requires there to be one or more spaces between the parameter name and value Result: mpathconf no longer converts find_multipaths_timeout lines into invalid lines when updating the find_multipaths parameter.
Clone Of:
: 1981594 (view as bug list)
Environment:
Last Closed: 2021-11-09 19:32:00 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 6169792 0 None None None 2021-07-06 15:40:08 UTC
Red Hat Product Errata RHBA-2021:4367 0 None None None 2021-11-09 19:32:15 UTC

Description Renaud Métrich 2021-07-06 07:07:59 UTC
Description of problem:

When specifying find_multipaths_timeout in /etc/multipath.conf and executing mpatchconf --enable to change the find_multipaths mode, the find_multipaths_timeout property is overwritten, as shown below:

Original /etc/multipath.conf:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
defaults {
	user_friendly_names yes
	find_multipaths yes
	find_multipaths_timeout 10
	enable_foreign "^$"
}
[...]
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Execute mpathconf:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# mpathconf --enable --with_multipathd y --find_multipaths strict
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Final result:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
defaults {
	user_friendly_names yes
	find_multipaths strict
	find_multipaths strict 10
	enable_foreign "^$"
}
[...]
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------


Version-Release number of selected component (if applicable):

device-mapper-multipath-0.8.4-10.el8.x86_64

How reproducible:

Always, see above.

Comment 1 Nitin U. Yewale 2021-07-06 13:31:46 UTC
Hi,

Following patch looks to be fixing the issue :

# cat mpathconf.patch 
--- /root/mpathconf.original	2021-07-06 18:40:15.514540136 +0530
+++ /usr/sbin/mpathconf	2021-07-06 18:44:36.757131720 +0530
@@ -331,7 +331,7 @@
 fi
 
 if [ "$HAVE_DEFAULTS" = "1" ]; then
-	HAVE_FIND=`sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | sed -n 's/^[[:blank:]]*find_multipaths[[:blank:]]*\([^[:blank:]]*\).*$/\1/p' | sed -n 1p`
+	HAVE_FIND=`sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | sed -n 's/^[[:blank:]]*find_multipaths[[:blank:]]\([^[:blank:]]*\).*$/\1/p' | sed -n 1p`
 	if [ "$HAVE_FIND" = "1" ]; then
 		HAVE_FIND="yes"
 	elif [ "$HAVE_FIND" = "0" ]; then
@@ -467,7 +467,7 @@
 ' $TMPFILE
 		CHANGED_CONFIG=1
 	elif [ "$FIND" != "$HAVE_FIND" ]; then
-		sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:blank:]]*find_multipaths[[:blank:]]*[^[:blank:]]*/	find_multipaths '"$FIND"'/' $TMPFILE
+		sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:blank:]]*find_multipaths[[:blank:]][^[:blank:]]*/	find_multipaths '"$FIND"'/' $TMPFILE
 		CHANGED_CONFIG=1
 	fi
 fi
[root@test1 tmp]# 

Thank you,
Nitin Yewale

Comment 2 Nitin U. Yewale 2021-07-06 13:34:46 UTC
Hi,

Tested following scenarios

[root@test1 ~]# cat /etc/multipath.conf

defaults {
	user_friendly_names yes
	find_multipaths no
	find_multipaths_timeout 10
	enable_foreign "^$"
}

After change :mpathconf --enable --with_multipathd y --find_multipaths strict

[root@test1 ~]# cat /etc/multipath.conf


defaults {
	user_friendly_names yes
	find_multipaths strict
	find_multipaths_timeout 10
	enable_foreign "^$"
}

[root@test1 ~]# 


=========================================================================================

[root@test1 ~]# cat /etc/multipath.conf

defaults {
	user_friendly_names yes
	find_multipaths_timeout 10
	enable_foreign "^$"
}

After change : mpathconf --enable --with_multipathd y --find_multipaths yes

[root@test1 ~]# cat /etc/multipath.conf

defaults {
	find_multipaths yes
	user_friendly_names yes
	find_multipaths_timeout 10
	enable_foreign "^$"
}


[root@test1 ~]# 


=========================================================================================

[root@test1 ~]# cat /etc/multipath.conf

defaults {
	user_friendly_names yes
	find_multipaths yes
	find_multipaths_timeout 10
	enable_foreign "^$"
}

After change : mpathconf --enable --with_multipathd y --find_multipaths strict

[root@test1 ~]# cat /etc/multipath.conf

defaults {
	user_friendly_names yes
	find_multipaths strict
	find_multipaths_timeout 10
	enable_foreign "^$"
}

[root@test1 ~]# 

=========================================================================================

[root@test1 ~]# cat /etc/multipath.conf

defaults {
	user_friendly_names yes
	enable_foreign "^$"
}

After change : mpathconf --enable --with_multipathd y --find_multipaths strict

[root@test1 ~]# cat /etc/multipath.conf

defaults {
	find_multipaths strict
	user_friendly_names yes
	enable_foreign "^$"
}

[root@test1 ~]# 


Thank you,
Nitin Yewale

Comment 4 Ben Marzinski 2021-07-08 21:59:54 UTC
Thanks for pointing this out. However, mpathconf should be able to handle lines like

find_multipaths    yes

where there are multiple spaces, so I plan to go with this instead:

# git diff
diff --git a/multipath/mpathconf b/multipath/mpathconf
index 2f4f3eaf..58077077 100644
--- a/multipath/mpathconf
+++ b/multipath/mpathconf
@@ -331,7 +331,7 @@ if [ "$HAVE_BLACKLIST" = "1" ]; then
 fi
 
 if [ "$HAVE_DEFAULTS" = "1" ]; then
-       HAVE_FIND=`sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | sed -n 's/^[[:blank:]]*find_multipaths[[:blank:]]*\([^[:blank:]]*\).*$/\1/p' | sed -n 1p`
+       HAVE_FIND=`sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | sed -n 's/^[[:blank:]]*find_multipaths[[:blank:]][[:blank:]]*\([^[:blank:]]*\).*$/\1/p' | sed -n 1p`
        if [ "$HAVE_FIND" = "1" ]; then
                HAVE_FIND="yes"
        elif [ "$HAVE_FIND" = "0" ]; then
@@ -467,7 +467,7 @@ if [ -n "$FIND" ]; then
 ' $TMPFILE
                CHANGED_CONFIG=1
        elif [ "$FIND" != "$HAVE_FIND" ]; then
-               sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:blank:]]*find_multipaths[[:blank:]]*[^[:blank:]]*/  find_multipaths '"$FIND"'/' $TMPFILE
+               sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:blank:]]*find_multipaths[[:blank:]][[:blank:]]*[^[:blank:]]*/       find_multipaths '"$FIND"'/' $TMPFILE
                CHANGED_CONFIG=1
        fi
 fi

Comment 5 Renaud Métrich 2021-07-09 07:05:56 UTC
Actually what would be even greater is to have mpathconf command handle this "find_multipaths_timeout" property.

Comment 7 Ben Marzinski 2021-07-09 20:00:56 UTC
The idea of mpathconf is to give the users the ability to change a few, commonly changed parameters. They are currently all ones where Red Hat has (or had) different defaults than upstream. I've considered giving mpathconf the ability to add any parameter to any section of multipath.conf, and you're welcome to file an RFE for that, but I'd like to just use this bugzilla to deal with the actual bug (and related space issues for the other parameters).

Comment 10 Ben Marzinski 2021-07-12 21:27:44 UTC
There were actually multiple places where mpathconf wasn't checking that existing parameters had one or more spaces between the parameter name and value. These have all been fixed.

Comment 14 Lin Li 2021-07-15 07:08:58 UTC
Reproduced on device-mapper-multipath-0.8.4-13.el8
1,[root@ibm-p9z-20-lp13 ~]# rpm -qa | grep multipath
device-mapper-multipath-libs-0.8.4-13.el8.ppc64le
device-mapper-multipath-0.8.4-13.el8.ppc64le

2,Edit /etc/multipath.conf 
[root@ibm-p9z-20-lp13 ~]# cat /etc/multipath.conf 
defaults {
    user_friendly_names yes
    find_multipaths yes
    find_multipaths_timeout 10
    enable_foreign "^$"
}

3,[root@ibm-p9z-20-lp13 ~]# mpathconf --enable --with_multipathd y --find_multipaths strict

4,check /etc/multipath.conf 
[root@ibm-p9z-20-lp13 ~]# cat /etc/multipath.conf 
defaults {
    user_friendly_names yes
	find_multipaths strict
	find_multipaths strict 10   <----------------------find_multipaths_timeout is overwritten
    enable_foreign "^$"
}


Verified on device-mapper-multipath-0.8.4-14.el8
1,[root@ibm-p9z-20-lp13 ~]# rpm -qa | grep multipath
device-mapper-multipath-libs-0.8.4-14.el8.ppc64le
device-mapper-multipath-0.8.4-14.el8.ppc64le
2,Edit /etc/multipath.conf 
[root@ibm-p9z-20-lp13 ~]# cat /etc/multipath.conf 
defaults {
    user_friendly_names yes
    find_multipaths yes
    find_multipaths_timeout 10
    enable_foreign "^$"
}

3,[root@ibm-p9z-20-lp13 ~]# mpathconf --enable --with_multipathd y --find_multipaths strict

4,check /etc/multipath.conf 
[root@ibm-p9z-20-lp13 ~]# cat /etc/multipath.conf 
defaults {
    user_friendly_names yes
    find_multipaths strict
    find_multipaths_timeout 10    <----------------------find_multipaths_timeout is not overwritten
    enable_foreign "^$"
}


Test result:When mpathconf checks the existing multipath.conf file for parameters, it requires there to be one or more spaces between the parameter name and value

Comment 18 errata-xmlrpc 2021-11-09 19:32:00 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (device-mapper-multipath bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:4367


Note You need to log in before you can comment on or make changes to this bug.