Skip to contentSkip to conversation

libmultipath: Fix MAPINFO_CHECK_UUID with partitions

PATCH In review Benjamin Marzinski 2 participants 4 messages Nov 21, 2024 Device mapper

lore
Share & tools
lore

Benjamin Marzinski

author maintainer
#0 lore raw

PATCH 1/1 libmultipath: Fix MAPINFO_CHECK_UUID with partitions

In libmp_mapinfo__(), if is_mpath_part_uuid() succeeded, instead of ending the 'if' statement, is_mpath_uuid() would be called because of the OR operator. This would always fail if is_mpath_part_uuid() passed. This meant that libmp_mapinfo__() could never match partitions with MAPINFO_CHECK_UUID.

Fix that by not calling is_mpath_uuid() if MAPINFO_PART_ONLY is set.

Fixes c1aa0285 ("libmultipath: make MAPINFO_CHECK_UUID work with partitions")
---
 libmultipath/devmapper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libmultipath/devmapper.c +1 -1
index 9714270d..224be512 100644
@@ -734,7 +734,7 @@ static int libmp_mapinfo__(int flags, mapid_t id, mapinfo_t info, const char *ma
 
 	if (flags & MAPINFO_CHECK_UUID &&
 	    ((flags & MAPINFO_PART_ONLY && !is_mpath_part_uuid(uuid, NULL)) ||
-	     !is_mpath_uuid(uuid))) {
+	     (!(flags & MAPINFO_PART_ONLY) && !is_mpath_uuid(uuid)))) {
 		condlog(4, "%s: UUID mismatch: %s", fname__, uuid);
 		return DMP_NO_MATCH;
 	}
Signature · 1 line
2.46.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Benjamin Marzinski

In libmp_mapinfo__(), if is_mpath_part_uuid() succeeded, instead of ending the 'if' statement, is_mpath_uuid() would be called because of the OR operator.  This would always fail if is_mpath_part_uuid() passed.
This meant that libmp_mapinfo__() could never match partitions with MAPINFO_CHECK_UUID.

Quoted 5 lines

Fix that by not calling is_mpath_uuid() if MAPINFO_PART_ONLY is set.

Fixes c1aa0285 ("libmultipath: make MAPINFO_CHECK_UUID work with

partitions")

Ouch. Thanks!!

author maintainer
#2 lore raw
Quoted 8 lines · Martin Wilck
Quoted 7 lines · Benjamin Marzinski

In libmp_mapinfo__(), if is_mpath_part_uuid() succeeded, instead of ending the 'if' statement, is_mpath_uuid() would be called because of the OR operator.  This would always fail if is_mpath_part_uuid() passed.
This meant that libmp_mapinfo__() could never match partitions with MAPINFO_CHECK_UUID.

Quoted 8 lines
Quoted 5 lines

Fix that by not calling is_mpath_uuid() if MAPINFO_PART_ONLY is set.

Fixes c1aa0285 ("libmultipath: make MAPINFO_CHECK_UUID work with

partitions")

Ouch. Thanks!!

So, in theory the next step would be to open a PR for the upstream stable branch, if that existed, right?

-Ben

author maintainer
#3 lore raw
Quoted 15 lines · Benjamin Marzinski
Quoted 14 lines · Martin Wilck
Quoted 12 lines · Benjamin Marzinski

In libmp_mapinfo__(), if is_mpath_part_uuid() succeeded, instead of ending the 'if' statement, is_mpath_uuid() would be called because of the OR operator.  This would always fail if is_mpath_part_uuid() passed.
This meant that libmp_mapinfo__() could never match partitions with MAPINFO_CHECK_UUID.

Fix that by not calling is_mpath_uuid() if MAPINFO_PART_ONLY is set.

Fixes c1aa0285 ("libmultipath: make MAPINFO_CHECK_UUID work with

partitions")

Quoted 5 lines
Quoted 2 lines

Ouch. Thanks!!

So, in theory the next step would be to open a PR for the upstream stable branch, if that existed, right?

But I suppose the better actual plan here is just to update the 0.11.0 PR.

Quoted 2 lines

-Ben