|
|
4728c8 |
---
|
|
|
4728c8 |
libmultipath/devmapper.c | 21 +++++++++++++++++----
|
|
|
4728c8 |
libmultipath/devmapper.h | 2 +-
|
|
|
4728c8 |
2 files changed, 18 insertions(+), 5 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 |
@@ -363,7 +363,7 @@ out:
|
|
|
4728c8 |
}
|
|
|
4728c8 |
|
|
|
4728c8 |
extern int
|
|
|
4728c8 |
-dm_get_map(char * name, unsigned long long * size, char * outparams)
|
|
|
4728c8 |
+dm_get_map(const char * name, unsigned long long * size, char * outparams)
|
|
|
4728c8 |
{
|
|
|
4728c8 |
int r = 1;
|
|
|
4728c8 |
struct dm_task *dmt;
|
|
|
4728c8 |
@@ -682,7 +682,9 @@ _dm_flush_map (const char * mapname, int
|
|
|
4728c8 |
extern int
|
|
|
4728c8 |
dm_suspend_and_flush_map (const char * mapname)
|
|
|
4728c8 |
{
|
|
|
4728c8 |
- int s;
|
|
|
4728c8 |
+ int s = 0, queue_if_no_path = 0;
|
|
|
4728c8 |
+ unsigned long long mapsize;
|
|
|
4728c8 |
+ char params[PARAMS_SIZE] = {0};
|
|
|
4728c8 |
|
|
|
4728c8 |
if (!dm_map_present(mapname))
|
|
|
4728c8 |
return 0;
|
|
|
4728c8 |
@@ -690,8 +692,17 @@ dm_suspend_and_flush_map (const char * m
|
|
|
4728c8 |
if (dm_type(mapname, TGT_MPATH) <= 0)
|
|
|
4728c8 |
return 0; /* nothing to do */
|
|
|
4728c8 |
|
|
|
4728c8 |
- s = dm_queue_if_no_path((char *)mapname, 0);
|
|
|
4728c8 |
- if (!s)
|
|
|
4728c8 |
+ if (!dm_get_map(mapname, &mapsize, params)) {
|
|
|
4728c8 |
+ if (strstr(params, "queue_if_no_path"))
|
|
|
4728c8 |
+ queue_if_no_path = 1;
|
|
|
4728c8 |
+ }
|
|
|
4728c8 |
+
|
|
|
4728c8 |
+ if (queue_if_no_path)
|
|
|
4728c8 |
+ s = dm_queue_if_no_path((char *)mapname, 0);
|
|
|
4728c8 |
+ /* Leave queue_if_no_path alone if unset failed */
|
|
|
4728c8 |
+ if (s)
|
|
|
4728c8 |
+ queue_if_no_path = 0;
|
|
|
4728c8 |
+ else
|
|
|
4728c8 |
s = dm_simplecmd_flush(DM_DEVICE_SUSPEND, mapname, 0);
|
|
|
4728c8 |
|
|
|
4728c8 |
if (!dm_flush_map(mapname)) {
|
|
|
4728c8 |
@@ -700,6 +711,8 @@ dm_suspend_and_flush_map (const char * m
|
|
|
4728c8 |
}
|
|
|
4728c8 |
condlog(2, "failed to remove multipath map %s", mapname);
|
|
|
4728c8 |
dm_simplecmd_noflush(DM_DEVICE_RESUME, mapname);
|
|
|
4728c8 |
+ if (queue_if_no_path)
|
|
|
4728c8 |
+ s = dm_queue_if_no_path((char *)mapname, 1);
|
|
|
4728c8 |
return 1;
|
|
|
4728c8 |
}
|
|
|
4728c8 |
|
|
|
4728c8 |
Index: multipath-tools-130222/libmultipath/devmapper.h
|
|
|
4728c8 |
===================================================================
|
|
|
4728c8 |
--- multipath-tools-130222.orig/libmultipath/devmapper.h
|
|
|
4728c8 |
+++ multipath-tools-130222/libmultipath/devmapper.h
|
|
|
4728c8 |
@@ -14,7 +14,7 @@ int dm_simplecmd_noflush (int, const cha
|
|
|
4728c8 |
int dm_addmap_create (struct multipath *mpp, char *params);
|
|
|
4728c8 |
int dm_addmap_reload (struct multipath *mpp, char *params);
|
|
|
4728c8 |
int dm_map_present (const char *);
|
|
|
4728c8 |
-int dm_get_map(char *, unsigned long long *, char *);
|
|
|
4728c8 |
+int dm_get_map(const char *, unsigned long long *, char *);
|
|
|
4728c8 |
int dm_get_status(char *, char *);
|
|
|
4728c8 |
int dm_type(const char *, char *);
|
|
|
4728c8 |
int _dm_flush_map (const char *, int);
|