diff --git a/0051-multipath-return-failure-on-an-invalid-remove-comman.patch b/0051-multipath-return-failure-on-an-invalid-remove-comman.patch new file mode 100644 index 0000000000000000000000000000000000000000..d07db18a3de1343f17d2ad69de0358a014aa38fb --- /dev/null +++ b/0051-multipath-return-failure-on-an-invalid-remove-comman.patch @@ -0,0 +1,38 @@ +From 774b5ad984a9c4f1d8d869d804ad1dc35dab7d8b Mon Sep 17 00:00:00 2001 +From: Benjamin Marzinski +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 +Reviewed-by: Martin Wilck remove_retries; + if (conf->remove == FLUSH_ONE) { + if (dev_type == DEV_DEVMAP) { ++ 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; + } else +-- +2.27.0 + diff --git a/multipath-tools.spec b/multipath-tools.spec index 95a02533f96639384fc4db97e162a8dec858cbfb..9de69ff0dd694fdfe5b2b9741467d6869910321d 100644 --- a/multipath-tools.spec +++ b/multipath-tools.spec @@ -2,7 +2,7 @@ Name: multipath-tools Version: 0.8.4 -Release: 26 +Release: 27 Summary: Tools to manage multipath devices with the device-mapper License: GPL-2.0-or-later and LGPL-2.0-only URL: http://christophe.varoqui.free.fr/ @@ -60,6 +60,7 @@ Patch47: 0047-libmultipath-sysfs_set_scsi_tmo-do-nothing-for-ACT_D.patch Patch48: 0048-multipath.conf.5-fix-documentation-for-find_multipat.patch Patch49: 0049-multipath.conf.5-fix-the-description-of-prio_args-fo.patch Patch50: 0050-multipath-display-the-correct-configuration-when-dum.patch +Patch51: 0051-multipath-return-failure-on-an-invalid-remove-comman.patch BuildRequires: multipath-tools, libcmocka, libcmocka-devel BuildRequires: gcc, libaio-devel, userspace-rcu-devel, device-mapper-devel >= 1.02.89 @@ -207,6 +208,9 @@ fi %changelog +* Wed Aug 7 2024 kouwenqi - 0.8.4-27 +- multipath: return failure on an invalid remove command + * Mon Aug 5 2024 kouwenqi - 0.8.4-26 - multipath: display the correct configuration when dumpping config