|
|
4ae388 |
---
|
|
|
4ae388 |
libmpathpersist/mpath_persist.c | 4 +-
|
|
|
4ae388 |
libmultipath/devmapper.c | 67 +++++++++++++++++++++++++++++-----------
|
|
|
4ae388 |
libmultipath/devmapper.h | 1
|
|
|
4ae388 |
multipathd/main.c | 2 -
|
|
|
4ae388 |
4 files changed, 53 insertions(+), 21 deletions(-)
|
|
|
4ae388 |
|
|
|
4ae388 |
Index: multipath-tools-130222/libmpathpersist/mpath_persist.c
|
|
|
4ae388 |
===================================================================
|
|
|
4ae388 |
--- multipath-tools-130222.orig/libmpathpersist/mpath_persist.c
|
|
|
4ae388 |
+++ multipath-tools-130222/libmpathpersist/mpath_persist.c
|
|
|
4ae388 |
@@ -160,7 +160,7 @@ int mpath_persistent_reserve_in (int fd,
|
|
|
4ae388 |
|
|
|
4ae388 |
condlog(3, "alias = %s", alias);
|
|
|
4ae388 |
map_present = dm_map_present(alias);
|
|
|
4ae388 |
- if (map_present && dm_type(alias, TGT_MPATH) <= 0){
|
|
|
4ae388 |
+ if (map_present && !dm_is_mpath(alias)){
|
|
|
4ae388 |
condlog( 0, "%s: not a multipath device.", alias);
|
|
|
4ae388 |
ret = MPATH_PR_DMMP_ERROR;
|
|
|
4ae388 |
goto out;
|
|
|
4ae388 |
@@ -250,7 +250,7 @@ int mpath_persistent_reserve_out ( int f
|
|
|
4ae388 |
condlog(3, "alias = %s", alias);
|
|
|
4ae388 |
map_present = dm_map_present(alias);
|
|
|
4ae388 |
|
|
|
4ae388 |
- if (map_present && dm_type(alias, TGT_MPATH) <= 0){
|
|
|
4ae388 |
+ if (map_present && !dm_is_mpath(alias)){
|
|
|
4ae388 |
condlog(3, "%s: not a multipath device.", alias);
|
|
|
4ae388 |
ret = MPATH_PR_DMMP_ERROR;
|
|
|
4ae388 |
goto out;
|
|
|
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 |
@@ -564,6 +564,48 @@ out:
|
|
|
4ae388 |
return r;
|
|
|
4ae388 |
}
|
|
|
4ae388 |
|
|
|
4ae388 |
+extern int
|
|
|
4ae388 |
+dm_is_mpath(const char * name)
|
|
|
4ae388 |
+{
|
|
|
4ae388 |
+ int r = 0;
|
|
|
4ae388 |
+ struct dm_task *dmt;
|
|
|
4ae388 |
+ struct dm_info info;
|
|
|
4ae388 |
+ uint64_t start, length;
|
|
|
4ae388 |
+ char *target_type = NULL;
|
|
|
4ae388 |
+ char *params;
|
|
|
4ae388 |
+ const char *uuid;
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+ if (!(dmt = dm_task_create(DM_DEVICE_TABLE)))
|
|
|
4ae388 |
+ return 0;
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+ if (!dm_task_set_name(dmt, name))
|
|
|
4ae388 |
+ goto out;
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+ dm_task_no_open_count(dmt);
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+ if (!dm_task_run(dmt))
|
|
|
4ae388 |
+ goto out;
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+ if (!dm_task_get_info(dmt, &info) || !info.exists)
|
|
|
4ae388 |
+ goto out;
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+ uuid = dm_task_get_uuid(dmt);
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+ if (!uuid || strncmp(uuid, UUID_PREFIX, UUID_PREFIX_LEN) != 0)
|
|
|
4ae388 |
+ goto out;
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+ /* Fetch 1st target */
|
|
|
4ae388 |
+ dm_get_next_target(dmt, NULL, &start, &length, &target_type, ¶ms);
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+ if (!target_type || strcmp(target_type, TGT_MPATH) != 0)
|
|
|
4ae388 |
+ goto out;
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+ r = 1;
|
|
|
4ae388 |
+out:
|
|
|
4ae388 |
+ dm_task_destroy(dmt);
|
|
|
4ae388 |
+ return r;
|
|
|
4ae388 |
+}
|
|
|
4ae388 |
+
|
|
|
4ae388 |
static int
|
|
|
4ae388 |
dm_dev_t (const char * mapname, char * dev_t, int len)
|
|
|
4ae388 |
{
|
|
|
4ae388 |
@@ -672,10 +714,7 @@ _dm_flush_map (const char * mapname, int
|
|
|
4ae388 |
{
|
|
|
4ae388 |
int r;
|
|
|
4ae388 |
|
|
|
4ae388 |
- if (!dm_map_present(mapname))
|
|
|
4ae388 |
- return 0;
|
|
|
4ae388 |
-
|
|
|
4ae388 |
- if (dm_type(mapname, TGT_MPATH) <= 0)
|
|
|
4ae388 |
+ if (!dm_is_mpath(mapname))
|
|
|
4ae388 |
return 0; /* nothing to do */
|
|
|
4ae388 |
|
|
|
4ae388 |
if (dm_remove_partmaps(mapname, need_sync, deferred_remove))
|
|
|
4ae388 |
@@ -725,10 +764,7 @@ dm_suspend_and_flush_map (const char * m
|
|
|
4ae388 |
unsigned long long mapsize;
|
|
|
4ae388 |
char params[PARAMS_SIZE] = {0};
|
|
|
4ae388 |
|
|
|
4ae388 |
- if (!dm_map_present(mapname))
|
|
|
4ae388 |
- return 0;
|
|
|
4ae388 |
-
|
|
|
4ae388 |
- if (dm_type(mapname, TGT_MPATH) <= 0)
|
|
|
4ae388 |
+ if (!dm_is_mpath(mapname))
|
|
|
4ae388 |
return 0; /* nothing to do */
|
|
|
4ae388 |
|
|
|
4ae388 |
if (!dm_get_map(mapname, &mapsize, params)) {
|
|
|
4ae388 |
@@ -899,7 +935,6 @@ dm_get_maps (vector mp)
|
|
|
4ae388 |
{
|
|
|
4ae388 |
struct multipath * mpp;
|
|
|
4ae388 |
int r = 1;
|
|
|
4ae388 |
- int info;
|
|
|
4ae388 |
struct dm_task *dmt;
|
|
|
4ae388 |
struct dm_names *names;
|
|
|
4ae388 |
unsigned next = 0;
|
|
|
4ae388 |
@@ -924,9 +959,7 @@ dm_get_maps (vector mp)
|
|
|
4ae388 |
}
|
|
|
4ae388 |
|
|
|
4ae388 |
do {
|
|
|
4ae388 |
- info = dm_type(names->name, TGT_MPATH);
|
|
|
4ae388 |
-
|
|
|
4ae388 |
- if (info <= 0)
|
|
|
4ae388 |
+ if (!dm_is_mpath(names->name))
|
|
|
4ae388 |
goto next;
|
|
|
4ae388 |
|
|
|
4ae388 |
mpp = alloc_multipath();
|
|
|
4ae388 |
@@ -939,13 +972,11 @@ dm_get_maps (vector mp)
|
|
|
4ae388 |
if (!mpp->alias)
|
|
|
4ae388 |
goto out1;
|
|
|
4ae388 |
|
|
|
4ae388 |
- if (info > 0) {
|
|
|
4ae388 |
- if (dm_get_map(names->name, &mpp->size, NULL))
|
|
|
4ae388 |
- goto out1;
|
|
|
4ae388 |
+ if (dm_get_map(names->name, &mpp->size, NULL))
|
|
|
4ae388 |
+ goto out1;
|
|
|
4ae388 |
|
|
|
4ae388 |
- dm_get_uuid(names->name, mpp->wwid);
|
|
|
4ae388 |
- dm_get_info(names->name, &mpp->dmi);
|
|
|
4ae388 |
- }
|
|
|
4ae388 |
+ dm_get_uuid(names->name, mpp->wwid);
|
|
|
4ae388 |
+ dm_get_info(names->name, &mpp->dmi);
|
|
|
4ae388 |
|
|
|
4ae388 |
if (!vector_alloc_slot(mp))
|
|
|
4ae388 |
goto out1;
|
|
|
4ae388 |
Index: multipath-tools-130222/libmultipath/devmapper.h
|
|
|
4ae388 |
===================================================================
|
|
|
4ae388 |
--- multipath-tools-130222.orig/libmultipath/devmapper.h
|
|
|
4ae388 |
+++ multipath-tools-130222/libmultipath/devmapper.h
|
|
|
4ae388 |
@@ -23,6 +23,7 @@ int dm_map_present (const char *);
|
|
|
4ae388 |
int dm_get_map(const char *, unsigned long long *, char *);
|
|
|
4ae388 |
int dm_get_status(char *, char *);
|
|
|
4ae388 |
int dm_type(const char *, char *);
|
|
|
4ae388 |
+int dm_is_mpath(const char *);
|
|
|
4ae388 |
int _dm_flush_map (const char *, int, int);
|
|
|
4ae388 |
int dm_flush_map_nopaths(const char * mapname, int deferred_remove);
|
|
|
4ae388 |
#define dm_flush_map(mapname) _dm_flush_map(mapname, 1, 0)
|
|
|
4ae388 |
Index: multipath-tools-130222/multipathd/main.c
|
|
|
4ae388 |
===================================================================
|
|
|
4ae388 |
--- multipath-tools-130222.orig/multipathd/main.c
|
|
|
4ae388 |
+++ multipath-tools-130222/multipathd/main.c
|
|
|
4ae388 |
@@ -285,7 +285,7 @@ ev_add_map (char * dev, char * alias, st
|
|
|
4ae388 |
|
|
|
4ae388 |
map_present = dm_map_present(alias);
|
|
|
4ae388 |
|
|
|
4ae388 |
- if (map_present && dm_type(alias, TGT_MPATH) <= 0) {
|
|
|
4ae388 |
+ if (map_present && !dm_is_mpath(alias)) {
|
|
|
4ae388 |
condlog(4, "%s: not a multipath map", alias);
|
|
|
4ae388 |
return 0;
|
|
|
4ae388 |
}
|