Blame SOURCES/0059-UP-flush-failure-queueing.patch

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