Blame SOURCES/0075-RHBZ-1056976-reload-flag.patch

f20720
---
f20720
 kpartx/devmapper.c        |    4 ++--
f20720
 kpartx/devmapper.h        |    8 +++++++-
f20720
 kpartx/kpartx.c           |    6 +++---
f20720
 libmultipath/configure.c  |    4 ++--
f20720
 libmultipath/devmapper.c  |   26 ++++++++++++++------------
f20720
 libmultipath/devmapper.h  |   10 ++++++++--
f20720
 multipathd/cli_handlers.c |    4 ++--
f20720
 7 files changed, 38 insertions(+), 24 deletions(-)
f20720
f20720
Index: multipath-tools-130222/kpartx/devmapper.c
f20720
===================================================================
f20720
--- multipath-tools-130222.orig/kpartx/devmapper.c
f20720
+++ multipath-tools-130222/kpartx/devmapper.c
f20720
@@ -60,7 +60,7 @@ dm_prereq (char * str, int x, int y, int
f20720
 }
f20720
 
f20720
 extern int
f20720
-dm_simplecmd (int task, const char *name, int no_flush, uint32_t *cookie) {
f20720
+dm_simplecmd (int task, const char *name, int no_flush, uint32_t *cookie, uint16_t udev_flags) {
f20720
 	int r = 0;
f20720
 	int udev_wait_flag = (task == DM_DEVICE_RESUME ||
f20720
 			      task == DM_DEVICE_REMOVE);
f20720
@@ -78,7 +78,7 @@ dm_simplecmd (int task, const char *name
f20720
 	if (no_flush)
f20720
 		dm_task_no_flush(dmt);
f20720
 
f20720
-	if (udev_wait_flag && !dm_task_set_cookie(dmt, cookie, (udev_sync)? 0 : DM_UDEV_DISABLE_LIBRARY_FALLBACK))
f20720
+	if (udev_wait_flag && !dm_task_set_cookie(dmt, cookie, ((udev_sync)? 0 : DM_UDEV_DISABLE_LIBRARY_FALLBACK) | udev_flags))
f20720
 		goto out;
f20720
 	r = dm_task_run(dmt);
f20720
 
f20720
Index: multipath-tools-130222/kpartx/devmapper.h
f20720
===================================================================
f20720
--- multipath-tools-130222.orig/kpartx/devmapper.h
f20720
+++ multipath-tools-130222/kpartx/devmapper.h
f20720
@@ -2,10 +2,16 @@
f20720
 #define MINOR(dev)      ((dev & 0xff) | ((dev >> 12) & 0xfff00))
f20720
 #define MKDEV(ma,mi)    ((mi & 0xff) | (ma << 8) | ((mi & ~0xff) << 12))
f20720
 
f20720
+#ifdef DM_SUBSYSTEM_UDEV_FLAG0
f20720
+#define MPATH_UDEV_RELOAD_FLAG DM_SUBSYSTEM_UDEV_FLAG0
f20720
+#else
f20720
+#define MPATH_UDEV_RELOAD_FLAG 0
f20720
+#endif
f20720
+
f20720
 extern int udev_sync;
f20720
 
f20720
 int dm_prereq (char *, int, int, int);
f20720
-int dm_simplecmd (int, const char *, int, uint32_t *);
f20720
+int dm_simplecmd (int, const char *, int, uint32_t *, uint16_t);
f20720
 int dm_addmap (int, const char *, const char *, const char *, uint64_t,
f20720
 	       int, const char *, int, mode_t, uid_t, gid_t, uint32_t *);
f20720
 int dm_map_present (char *);
f20720
Index: multipath-tools-130222/kpartx/kpartx.c
f20720
===================================================================
f20720
--- multipath-tools-130222.orig/kpartx/kpartx.c
f20720
+++ multipath-tools-130222/kpartx/kpartx.c
f20720
@@ -421,7 +421,7 @@ main(int argc, char **argv){
f20720
 					continue;
f20720
 
f20720
 				if (!dm_simplecmd(DM_DEVICE_REMOVE, partname,
f20720
-						  0, &cookie)) {
f20720
+						  0, &cookie, 0)) {
f20720
 					r++;
f20720
 					continue;
f20720
 				}
f20720
@@ -473,7 +473,7 @@ main(int argc, char **argv){
f20720
 				}
f20720
 				if (op == DM_DEVICE_RELOAD &&
f20720
 				    !dm_simplecmd(DM_DEVICE_RESUME, partname,
f20720
-						  1, &cookie)) {
f20720
+						  1, &cookie, MPATH_UDEV_RELOAD_FLAG)) {
f20720
 					fprintf(stderr, "resume failed on %s\n",
f20720
 						partname);
f20720
 					r++;
f20720
@@ -505,7 +505,7 @@ main(int argc, char **argv){
f20720
 					continue;
f20720
 
f20720
 				if (!dm_simplecmd(DM_DEVICE_REMOVE,
f20720
-						  partname, 1, &cookie)) {
f20720
+						  partname, 1, &cookie, 0)) {
f20720
 					r++;
f20720
 					continue;
f20720
 				}
f20720
Index: multipath-tools-130222/libmultipath/configure.c
f20720
===================================================================
f20720
--- multipath-tools-130222.orig/libmultipath/configure.c
f20720
+++ multipath-tools-130222/libmultipath/configure.c
f20720
@@ -390,13 +390,13 @@ domap (struct multipath * mpp, char * pa
f20720
 	case ACT_RELOAD:
f20720
 		r = dm_addmap_reload(mpp, params);
f20720
 		if (r)
f20720
-			r = dm_simplecmd_noflush(DM_DEVICE_RESUME, mpp->alias);
f20720
+			r = dm_simplecmd_noflush(DM_DEVICE_RESUME, mpp->alias, MPATH_UDEV_RELOAD_FLAG);
f20720
 		break;
f20720
 
f20720
 	case ACT_RESIZE:
f20720
 		r = dm_addmap_reload(mpp, params);
f20720
 		if (r)
f20720
-			r = dm_simplecmd_flush(DM_DEVICE_RESUME, mpp->alias, 1);
f20720
+			r = dm_simplecmd_flush(DM_DEVICE_RESUME, mpp->alias, 1, 0);
f20720
 		break;
f20720
 
f20720
 	case ACT_RENAME:
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
@@ -103,7 +103,9 @@ dm_lib_prereq (void)
f20720
 {
f20720
 	char version[64];
f20720
 	int v[3];
f20720
-#ifdef LIBDM_API_COOKIE
f20720
+#if defined(DM_SUBSYSTEM_UDEV_FLAG0)
f20720
+	int minv[3] = {1, 2, 82};
f20720
+#elif defined(LIBDM_API_COOKIE)
f20720
 	int minv[3] = {1, 2, 38};
f20720
 #else
f20720
 	int minv[3] = {1, 2, 8};
f20720
@@ -200,7 +202,7 @@ dm_prereq (void)
f20720
 }
f20720
 
f20720
 static int
f20720
-dm_simplecmd (int task, const char *name, int no_flush, int need_sync) {
f20720
+dm_simplecmd (int task, const char *name, int no_flush, int need_sync, uint16_t udev_flags) {
f20720
 	int r = 0;
f20720
 	int udev_wait_flag = (need_sync && (task == DM_DEVICE_RESUME ||
f20720
 					    task == DM_DEVICE_REMOVE));
f20720
@@ -219,7 +221,7 @@ dm_simplecmd (int task, const char *name
f20720
 		dm_task_no_flush(dmt);		/* for DM_DEVICE_SUSPEND/RESUME */
f20720
 #endif
f20720
 
f20720
-	if (udev_wait_flag && !dm_task_set_cookie(dmt, &conf->cookie, (conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0))
f20720
+	if (udev_wait_flag && !dm_task_set_cookie(dmt, &conf->cookie, ((conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0) | udev_flags))
f20720
 		goto out;
f20720
 	r = dm_task_run (dmt);
f20720
 
f20720
@@ -229,13 +231,13 @@ dm_simplecmd (int task, const char *name
f20720
 }
f20720
 
f20720
 extern int
f20720
-dm_simplecmd_flush (int task, const char *name, int needsync) {
f20720
-	return dm_simplecmd(task, name, 0, needsync);
f20720
+dm_simplecmd_flush (int task, const char *name, int needsync, uint16_t udev_flags) {
f20720
+	return dm_simplecmd(task, name, 0, needsync, udev_flags);
f20720
 }
f20720
 
f20720
 extern int
f20720
-dm_simplecmd_noflush (int task, const char *name) {
f20720
-	return dm_simplecmd(task, name, 1, 1);
f20720
+dm_simplecmd_noflush (int task, const char *name, uint16_t udev_flags) {
f20720
+	return dm_simplecmd(task, name, 1, 1, udev_flags);
f20720
 }
f20720
 
f20720
 extern int
f20720
@@ -670,7 +672,7 @@ _dm_flush_map (const char * mapname, int
f20720
 		return 1;
f20720
 	}
f20720
 
f20720
-	r = dm_simplecmd_flush(DM_DEVICE_REMOVE, mapname, need_sync);
f20720
+	r = dm_simplecmd_flush(DM_DEVICE_REMOVE, mapname, need_sync, 0);
f20720
 
f20720
 	if (r) {
f20720
 		condlog(4, "multipath map %s removed", mapname);
f20720
@@ -703,14 +705,14 @@ dm_suspend_and_flush_map (const char * m
f20720
 	if (s)
f20720
 		queue_if_no_path = 0;
f20720
 	else
f20720
-		s = dm_simplecmd_flush(DM_DEVICE_SUSPEND, mapname, 0);
f20720
+		s = dm_simplecmd_flush(DM_DEVICE_SUSPEND, mapname, 0, 0);
f20720
 
f20720
 	if (!dm_flush_map(mapname)) {
f20720
 		condlog(4, "multipath map %s removed", mapname);
f20720
 		return 0;
f20720
 	}
f20720
 	condlog(2, "failed to remove multipath map %s", mapname);
f20720
-	dm_simplecmd_noflush(DM_DEVICE_RESUME, mapname);
f20720
+	dm_simplecmd_noflush(DM_DEVICE_RESUME, mapname, 0);
f20720
 	if (queue_if_no_path)
f20720
 		s = dm_queue_if_no_path((char *)mapname, 1);
f20720
 	return 1;
f20720
@@ -1077,7 +1079,7 @@ dm_remove_partmaps (const char * mapname
f20720
 			condlog(4, "partition map %s removed",
f20720
 				names->name);
f20720
 			dm_simplecmd_flush(DM_DEVICE_REMOVE, names->name,
f20720
-					   need_sync);
f20720
+					   need_sync, 0);
f20720
 		}
f20720
 
f20720
 		next = names->next;
f20720
@@ -1305,7 +1307,7 @@ int dm_reassign_table(const char *name,
f20720
 			condlog(3, "%s: failed to reassign targets", name);
f20720
 			goto out_reload;
f20720
 		}
f20720
-		dm_simplecmd_noflush(DM_DEVICE_RESUME, name);
f20720
+		dm_simplecmd_noflush(DM_DEVICE_RESUME, name, MPATH_UDEV_RELOAD_FLAG);
f20720
 	}
f20720
 	r = 1;
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
@@ -6,11 +6,17 @@
f20720
 #define TGT_MPATH	"multipath"
f20720
 #define TGT_PART	"linear"
f20720
 
f20720
+#ifdef DM_SUBSYSTEM_UDEV_FLAG0
f20720
+#define MPATH_UDEV_RELOAD_FLAG DM_SUBSYSTEM_UDEV_FLAG0
f20720
+#else
f20720
+#define MPATH_UDEV_RELOAD_FLAG 0
f20720
+#endif
f20720
+
f20720
 void dm_init(void);
f20720
 int dm_prereq (void);
f20720
 int dm_drv_version (unsigned int * version, char * str);
f20720
-int dm_simplecmd_flush (int, const char *, int);
f20720
-int dm_simplecmd_noflush (int, const char *);
f20720
+int dm_simplecmd_flush (int, const char *, int, uint16_t);
f20720
+int dm_simplecmd_noflush (int, const char *, uint16_t);
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
Index: multipath-tools-130222/multipathd/cli_handlers.c
f20720
===================================================================
f20720
--- multipath-tools-130222.orig/multipathd/cli_handlers.c
f20720
+++ multipath-tools-130222/multipathd/cli_handlers.c
f20720
@@ -783,7 +783,7 @@ cli_suspend(void * v, char ** reply, int
f20720
 {
f20720
 	struct vectors * vecs = (struct vectors *)data;
f20720
 	char * param = get_keyparam(v, MAP);
f20720
-	int r = dm_simplecmd_noflush(DM_DEVICE_SUSPEND, param);
f20720
+	int r = dm_simplecmd_noflush(DM_DEVICE_SUSPEND, param, 0);
f20720
 
f20720
 	param = convert_dev(param, 0);
f20720
 	condlog(2, "%s: suspend (operator)", param);
f20720
@@ -805,7 +805,7 @@ cli_resume(void * v, char ** reply, int
f20720
 {
f20720
 	struct vectors * vecs = (struct vectors *)data;
f20720
 	char * param = get_keyparam(v, MAP);
f20720
-	int r = dm_simplecmd_noflush(DM_DEVICE_RESUME, param);
f20720
+	int r = dm_simplecmd_noflush(DM_DEVICE_RESUME, param, 0);
f20720
 
f20720
 	param = convert_dev(param, 0);
f20720
 	condlog(2, "%s: resume (operator)", param);