diff mbox series

[RFC,8/8] libmultipath: remove devices with no table and multipath DM UUID

Message ID 20241031183301.391416-9-bmarzins@redhat.com (mailing list archive)
State Not Applicable, archived
Delegated to: Benjamin Marzinski
Headers show
Series multipath fixes to tableless device handling | expand

Commit Message

Benjamin Marzinski Oct. 31, 2024, 6:33 p.m. UTC
if dm_get_multipath() returns DMP_BAD_DEV in dm_get_maps(), it means
that it found an device with a DM UUID prefix of "mpath-" but no table.
Treat this as the remains of a failed device creation, and remove it
like dm_addmap_create() does when it fails to fully create a device and
it's left in this state.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
 libmultipath/devmapper.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
index 0d1552f5..908d759c 100644
--- a/libmultipath/devmapper.c
+++ b/libmultipath/devmapper.c
@@ -1283,6 +1283,10 @@  int dm_get_maps(vector mp)
 			vector_set_slot(mp, mpp);
 			break;
 		case DMP_BAD_DEV:
+			condlog(2, "%s: removing empty multipath device",
+				names->name);
+			dm_device_remove(names->name, 0);
+			break;
 		case DMP_NO_MATCH:
 		case DMP_NOT_FOUND:
 			break;