Bug 1984723

Summary: Mpathpersist returns 0 eventhough command doesn't run successfully.
Product: Red Hat Enterprise Linux 8 Reporter: Lin Li <lilin>
Component: device-mapper-multipathAssignee: Ben Marzinski <bmarzins>
Status: CLOSED ERRATA QA Contact: Lin Li <lilin>
Severity: high Docs Contact:
Priority: medium    
Version: 8.5CC: agk, bmarzins, heinzm, msnitzer, prajnoha, zkabelac
Target Milestone: betaKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: ppc64le   
OS: Linux   
Whiteboard:
Fixed In Version: device-mapper-multipath-0.8.4-17.el8 Doc Type: Bug Fix
Doc Text:
Cause: some mpathpersist commands were returning success if they did not work, since there were no good paths to use. Consequence: mpathpersist could return success, even though the command faled Fix: mpathpersist now returns failure if there were no usable paths. Result: mpathpersist will now correctly return failure in cases where a command failed because there were no usable paths.
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-09 19:32:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Lin Li 2021-07-22 02:25:45 UTC
Description of problem:
Mpathpersist returns 0 eventhough command doesn't run successfully.

Version-Release number of selected component (if applicable):
device-mapper-multipath-0.8.4-14.el8.ppc64le

How reproducible:
always

Steps to Reproduce:
1.[root@ibm-p9z-20-lp15 ~]# rpm -qa | grep multipath
device-mapper-multipath-libs-0.8.4-14.el8.ppc64le
device-mapper-multipath-0.8.4-14.el8.ppc64le

2.[root@ibm-p9z-20-lp15 ~]# multipath -ll
mpatha (3600601605e203f008e22d0221f07eb11) dm-0 DGC,VRAID
size=8.0G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
|-+- policy='service-time 0' prio=10 status=enabled
| |- 1:0:0:0 sda 8:0  active ready running
| `- 2:0:0:0 sdc 8:32 active ready running
`-+- policy='service-time 0' prio=50 status=enabled
  |- 1:0:1:0 sdb 8:16 active ready running
  `- 2:0:1:0 sdd 8:48 active ready running

3.[root@ibm-p9z-20-lp15 ~]# mpathpersist -i -k /dev/mapper/mpatha
  PR generation=0x0, 	0 registered reservation key.

4.[root@ibm-p9z-20-lp15 ~]# mv /etc/multipath.conf /

5.[root@ibm-p9z-20-lp15 ~]# mpathpersist --out -C --param-rk=0 /dev/mapper/mpatha
Jul 21 22:18:12 | /etc/multipath.conf does not exist, blacklisting all devices.
Jul 21 22:18:12 | You can run "/sbin/mpathconf --enable" to create
Jul 21 22:18:12 | /etc/multipath.conf. See man mpathconf(8) for more details

6.[root@ibm-p9z-20-lp15 ~]# echo $?
0  <-----------------------


Actual results:
Mpathpersist returns 0 when command doesn't run successfully

Expected results:
Mpathpersist returns a failure when command doesn't run successfully

Additional info:

Comment 4 Lin Li 2021-07-29 01:53:08 UTC
Verified on device-mapper-multipath-0.8.4-17.el8
1,[root@ibm-p9z-20-lp13 ~]# rpm -qa | grep multipath
device-mapper-multipath-libs-0.8.4-17.el8.ppc64le
device-mapper-multipath-0.8.4-17.el8.ppc64le

2,[root@ibm-p9z-20-lp13 ~]# multipath -ll
mpatha (3600601605e203f00d6ed8ff61e07eb11) dm-0 DGC,VRAID
size=8.0G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
|-+- policy='service-time 0' prio=10 status=enabled
| |- 1:0:0:0 sda 8:0  active ready running
| `- 2:0:0:0 sdc 8:32 active ready running
`-+- policy='service-time 0' prio=50 status=enabled
  |- 1:0:1:0 sdb 8:16 active ready running
  `- 2:0:1:0 sdd 8:48 active ready running
 
3,[root@ibm-p9z-20-lp13 ~]# mpathpersist -i -k /dev/mapper/mpatha
  PR generation=0x0, 	0 registered reservation key.

4,[root@ibm-p9z-20-lp13 ~]# mv /etc/multipath.conf /
[root@ibm-p9z-20-lp13 ~]# mpathpersist --out -C --param-rk=0 /dev/mapper/mpatha
Jul 28 21:51:11 | /etc/multipath.conf does not exist, blacklisting all devices.
Jul 28 21:51:11 | You can run "/sbin/mpathconf --enable" to create
Jul 28 21:51:11 | /etc/multipath.conf. See man mpathconf(8) for more details
Jul 28 21:51:11 | 3600601605e203f00d6ed8ff61e07eb11: no path available
PR out: command failed

5,[root@ibm-p9z-20-lp13 ~]# echo $?
13

Comment 7 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