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

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