device-mapper-multipath/0046-multipath-return-failure-on-an-invalid-remove-comman.patch
Benjamin Marzinski ceaf51092f device-mapper-multipath-0.8.7-9
- Add 0045-multipath-tools-update-mpp-force_readonly-in-ev_add_.patch
  * Fixes bz #2084356
- Add 0046-multipath-return-failure-on-an-invalid-remove-comman.patch
  * Fixes bz #2084358
- Add 0047-libmultipath-steal-the-src-string-pointer-in-merge_s.patch
- Add 0048-libmultipath-enable-linear-ordering-of-bus-proto-tup.patch
- Add 0049-libmultipath-use-bus_protocol_id-in-snprint_path_pro.patch
- Add 0050-libmultipath-make-protocol_name-global.patch
- Add 0051-libmultipath-add-a-protocol-subsection-to-multipath..patch
- Add 0052-libmultipath-Set-the-scsi-timeout-parameters-by-path.patch
- Add 0053-libmultipath-check-the-overrides-pctable-for-path-va.patch
- Add 0054-libmultipath-fix-eh_deadline-documentation.patch
- Add 0055-libmultipath-Add-documentation-for-the-protocol-subs.patch
- Add 0056-libmultipath-use-symbolic-value-for-invalid-pcentry.patch
  * The above 10 patches implement the feature from bz #2084365
- Add 0057-updated-HPE-MSA-builtin-config.patch
  * Fixes bz #2084357
Resolves: bz #2084365, #2084357, #2084358, #2084365
2022-05-16 23:24:24 -05:00

36 lines
1.3 KiB
Diff

From 0000000000000000000000000000000000000000 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 80fa68e5..41d01c7e 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -1111,6 +1111,11 @@ main (int argc, char *argv[])
if (retries < 0)
retries = conf->remove_retries;
if (cmd == CMD_FLUSH_ONE) {
+ 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;
goto out;