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