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

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