|
|
4728c8 |
---
|
|
|
4728c8 |
libmultipath/devmapper.c | 53 +++++++++++++++++++++--------------------------
|
|
|
4728c8 |
1 file changed, 24 insertions(+), 29 deletions(-)
|
|
|
4728c8 |
|
|
|
4728c8 |
Index: multipath-tools-130222/libmultipath/devmapper.c
|
|
|
4728c8 |
===================================================================
|
|
|
4728c8 |
--- multipath-tools-130222.orig/libmultipath/devmapper.c
|
|
|
4728c8 |
+++ multipath-tools-130222/libmultipath/devmapper.c
|
|
|
4728c8 |
@@ -466,42 +466,35 @@ uuidout:
|
|
|
4728c8 |
extern int
|
|
|
4728c8 |
dm_get_uuid(char *name, char *uuid)
|
|
|
4728c8 |
{
|
|
|
4728c8 |
- char uuidtmp[WWID_SIZE];
|
|
|
4728c8 |
-
|
|
|
4728c8 |
- if (dm_get_prefixed_uuid(name, uuidtmp))
|
|
|
4728c8 |
+ if (dm_get_prefixed_uuid(name, uuid))
|
|
|
4728c8 |
return 1;
|
|
|
4728c8 |
|
|
|
4728c8 |
- if (!strncmp(uuidtmp, UUID_PREFIX, UUID_PREFIX_LEN))
|
|
|
4728c8 |
- strcpy(uuid, uuidtmp + UUID_PREFIX_LEN);
|
|
|
4728c8 |
- else
|
|
|
4728c8 |
- strcpy(uuid, uuidtmp);
|
|
|
4728c8 |
-
|
|
|
4728c8 |
+ if (!strncmp(uuid, UUID_PREFIX, UUID_PREFIX_LEN))
|
|
|
4728c8 |
+ memmove(uuid, uuid + UUID_PREFIX_LEN,
|
|
|
4728c8 |
+ strlen(uuid + UUID_PREFIX_LEN) + 1);
|
|
|
4728c8 |
return 0;
|
|
|
4728c8 |
}
|
|
|
4728c8 |
|
|
|
4728c8 |
-/*
|
|
|
4728c8 |
- * returns:
|
|
|
4728c8 |
- * 0 : if both uuids end with same suffix which starts with UUID_PREFIX
|
|
|
4728c8 |
- * 1 : otherwise
|
|
|
4728c8 |
- */
|
|
|
4728c8 |
-int
|
|
|
4728c8 |
-dm_compare_uuid(const char* mapname1, const char* mapname2)
|
|
|
4728c8 |
+static int
|
|
|
4728c8 |
+is_mpath_part(const char *part_name, const char *map_name)
|
|
|
4728c8 |
{
|
|
|
4728c8 |
- char *p1, *p2;
|
|
|
4728c8 |
- char uuid1[WWID_SIZE], uuid2[WWID_SIZE];
|
|
|
4728c8 |
+ char *p;
|
|
|
4728c8 |
+ char part_uuid[WWID_SIZE], map_uuid[WWID_SIZE];
|
|
|
4728c8 |
|
|
|
4728c8 |
- if (dm_get_prefixed_uuid(mapname1, uuid1))
|
|
|
4728c8 |
- return 1;
|
|
|
4728c8 |
+ if (dm_get_prefixed_uuid(part_name, part_uuid))
|
|
|
4728c8 |
+ return 0;
|
|
|
4728c8 |
|
|
|
4728c8 |
- if (dm_get_prefixed_uuid(mapname2, uuid2))
|
|
|
4728c8 |
- return 1;
|
|
|
4728c8 |
+ if (dm_get_prefixed_uuid(map_name, map_uuid))
|
|
|
4728c8 |
+ return 0;
|
|
|
4728c8 |
|
|
|
4728c8 |
- p1 = strstr(uuid1, UUID_PREFIX);
|
|
|
4728c8 |
- p2 = strstr(uuid2, UUID_PREFIX);
|
|
|
4728c8 |
- if (p1 && p2 && !strcmp(p1, p2))
|
|
|
4728c8 |
+ if (strncmp(part_uuid, "part", 4) != 0)
|
|
|
4728c8 |
return 0;
|
|
|
4728c8 |
|
|
|
4728c8 |
- return 1;
|
|
|
4728c8 |
+ p = strstr(part_uuid, UUID_PREFIX);
|
|
|
4728c8 |
+ if (p && !strcmp(p, map_uuid))
|
|
|
4728c8 |
+ return 1;
|
|
|
4728c8 |
+
|
|
|
4728c8 |
+ return 0;
|
|
|
4728c8 |
}
|
|
|
4728c8 |
|
|
|
4728c8 |
extern int
|
|
|
4728c8 |
@@ -1143,6 +1136,7 @@ do_foreach_partmaps (const char * mapnam
|
|
|
4728c8 |
unsigned long long size;
|
|
|
4728c8 |
char dev_t[32];
|
|
|
4728c8 |
int r = 1;
|
|
|
4728c8 |
+ char *p;
|
|
|
4728c8 |
|
|
|
4728c8 |
if (!(dmt = dm_task_create(DM_DEVICE_LIST)))
|
|
|
4728c8 |
return 1;
|
|
|
4728c8 |
@@ -1171,10 +1165,10 @@ do_foreach_partmaps (const char * mapnam
|
|
|
4728c8 |
(dm_type(names->name, TGT_PART) > 0) &&
|
|
|
4728c8 |
|
|
|
4728c8 |
/*
|
|
|
4728c8 |
- * and both uuid end with same suffix starting
|
|
|
4728c8 |
- * at UUID_PREFIX
|
|
|
4728c8 |
+ * and the uuid of the target is a partition of the
|
|
|
4728c8 |
+ * uuid of the multipath device
|
|
|
4728c8 |
*/
|
|
|
4728c8 |
- (!dm_compare_uuid(names->name, mapname)) &&
|
|
|
4728c8 |
+ is_mpath_part(names->name, mapname) &&
|
|
|
4728c8 |
|
|
|
4728c8 |
/*
|
|
|
4728c8 |
* and we can fetch the map table from the kernel
|
|
|
4728c8 |
@@ -1184,7 +1178,8 @@ do_foreach_partmaps (const char * mapnam
|
|
|
4728c8 |
/*
|
|
|
4728c8 |
* and the table maps over the multipath map
|
|
|
4728c8 |
*/
|
|
|
4728c8 |
- strstr(params, dev_t)
|
|
|
4728c8 |
+ (p = strstr(params, dev_t)) &&
|
|
|
4728c8 |
+ !isdigit(*(p + strlen(dev_t)))
|
|
|
4728c8 |
) {
|
|
|
4728c8 |
if (partmap_func(names->name, data) != 0)
|
|
|
4728c8 |
goto out;
|