Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 2084358

Summary: multipath removal (multipath -f) should return non zero when attempted on a non existent device
Product: Red Hat Enterprise Linux 9 Reporter: Ben Marzinski <bmarzins>
Component: device-mapper-multipathAssignee: Ben Marzinski <bmarzins>
Status: CLOSED ERRATA QA Contact: Lin Li <lilin>
Severity: low Docs Contact:
Priority: medium    
Version: 9.0CC: agk, bmarzins, cmarthal, heinzm, lilin, msnitzer, prajnoha, zkabelac
Target Milestone: rcKeywords: Triaged
Target Release: 9.1Flags: pm-rhel: mirror+
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: device-mapper-multipath-0.8.7-9.el9 Doc Type: Bug Fix
Doc Text:
Cause: "multipath -f <device>" was returning success if there was no work that needed to be done. Consequence: If "multipath -f" was run on a non-existent or non-multipath device, it would return success, since there was no device to remove Fix: multipath now returns failure when a remove is attempted on an invalid device. Result: running "multipath -f" on a non-existent device now fails.
Story Points: ---
Clone Of: 2052054 Environment:
Last Closed: 2022-11-15 11:16:24 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:
Bug Depends On: 2052054    
Bug Blocks:    

Description Ben Marzinski 2022-05-11 23:56:21 UTC
+++ This bug was initially created as a clone of Bug #2052054 +++

Description of problem:
[root@hayes-02 ~]#  multipath -ll
mpatha (36d094660650d1e0022bd29e81db0cefc) dm-0 DELL,PERC H330 Adp
size=1.8T features='0' hwhandler='0' wp=rw
`-+- policy='service-time 0' prio=1 status=active
  `- 0:2:1:0  sdb 8:16  active ready running
[root@hayes-02 ~]#
[root@hayes-02 ~]# multipath -f foobar
[root@hayes-02 ~]# echo $?
0
[root@hayes-02 ~]# multipath -f mpatha
[root@hayes-02 ~]# echo $?
0
[root@hayes-02 ~]#  multipath -ll


Version-Release number of selected component (if applicable):
device-mapper-multipath-0.8.4-21.el8.x86_64    BUILT: Tue 18 Jan 2022 10:22:51 PM CST
kernel-4.18.0-360.el8    BUILT: Sun Jan 16 20:27:55 CST 2022

Comment 1 Ben Marzinski 2022-05-17 16:44:11 UTC
Multipath now returns an error if you try to remove a non-existent device.

Comment 4 Lin Li 2022-06-01 10:18:32 UTC
Verified on device-mapper-multipath-0.8.7-9.el9
[root@storageqe-05 ~]# rpm -qa | grep multipath
device-mapper-multipath-libs-0.8.7-9.el9.x86_64
device-mapper-multipath-0.8.7-9.el9.x86_64

[root@storageqe-05 ~]# multipath -ll
360a98000324669436c2b45666c567865 dm-3 NETAPP,LUN
size=2.0G features='3 queue_if_no_path pg_init_retries 50' hwhandler='1 alua' wp=rw
|-+- policy='service-time 0' prio=50 status=active
| |- 3:0:0:0 sdj 8:144 active ready running
| `- 4:0:1:0 sdf 8:80  active ready running
`-+- policy='service-time 0' prio=10 status=enabled
  |- 3:0:1:0 sdn 8:208 active ready running
  `- 4:0:0:0 sdb 8:16  active ready running
360a98000324669436c2b45666c567867 dm-4 NETAPP,LUN
size=2.0G features='3 queue_if_no_path pg_init_retries 50' hwhandler='1 alua' wp=rw
|-+- policy='service-time 0' prio=50 status=active
| |- 3:0:0:1 sdk 8:160 active ready running
| `- 4:0:1:1 sdg 8:96  active ready running
`-+- policy='service-time 0' prio=10 status=enabled
  |- 3:0:1:1 sdo 8:224 active ready running
  `- 4:0:0:1 sdc 8:32  active ready running
360a98000324669436c2b45666c567869 dm-5 NETAPP,LUN
size=2.0G features='3 queue_if_no_path pg_init_retries 50' hwhandler='1 alua' wp=rw
|-+- policy='service-time 0' prio=50 status=active
| |- 3:0:0:2 sdl 8:176 active ready running
| `- 4:0:1:2 sdh 8:112 active ready running
`-+- policy='service-time 0' prio=10 status=enabled
  |- 3:0:1:2 sdp 8:240 active ready running
  `- 4:0:0:2 sdd 8:48  active ready running
360a98000324669436c2b45666c56786b dm-6 NETAPP,LUN
size=2.0G features='3 queue_if_no_path pg_init_retries 50' hwhandler='1 alua' wp=rw
|-+- policy='service-time 0' prio=50 status=active
| |- 3:0:0:3 sdm 8:192 active ready running
| `- 4:0:1:3 sdi 8:128 active ready running
`-+- policy='service-time 0' prio=10 status=enabled
  |- 3:0:1:3 sdq 65:0  active ready running
  `- 4:0:0:3 sde 8:64  active ready running

[root@storageqe-05 ~]# multipath -f foobar
13227.669622 | libdevmapper: ioctl/libdm-iface.c(1947): device-mapper: table ioctl on foobar  failed: No such device or address
13227.669667 | foobar is not a multipath device  <-----------------------------------
[root@storageqe-05 ~]# echo $?
1   <-----------------------------------
[root@storageqe-05 ~]# 
[root@storageqe-05 ~]# multipath -f 360a98000324669436c2b45666c56786b
[root@storageqe-05 ~]# echo $?
0



Test result: multipath removal (multipath -f) returns non zero when attempted on a non existent device

Comment 6 errata-xmlrpc 2022-11-15 11:16:24 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-2022:8313