Blame SOURCES/0135-RHBZ-1299600-path-dev-uevents.patch

4ae388
---
4ae388
 libmultipath/configure.c |   30 ++++++++++++++++++++++++++++--
4ae388
 libmultipath/configure.h |    1 +
4ae388
 libmultipath/wwids.c     |    4 ++--
4ae388
 multipath/main.c         |    2 +-
4ae388
 multipathd/main.c        |    3 ++-
4ae388
 5 files changed, 34 insertions(+), 6 deletions(-)
4ae388
4ae388
Index: multipath-tools-130222/libmultipath/configure.c
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/configure.c
4ae388
+++ multipath-tools-130222/libmultipath/configure.c
4ae388
@@ -38,6 +38,7 @@
4ae388
 #include "util.h"
4ae388
 #include "uxsock.h"
4ae388
 #include "wwids.h"
4ae388
+#include "sysfs.h"
4ae388
 
4ae388
 /* group paths in pg by host adapter
4ae388
  */
4ae388
@@ -569,6 +570,29 @@ fail:
4ae388
 	return 1;
4ae388
 }
4ae388
 
4ae388
+void
4ae388
+trigger_uevents (struct multipath *mpp)
4ae388
+{
4ae388
+	struct pathgroup * pgp;
4ae388
+	struct path * pp;
4ae388
+	int i, j;
4ae388
+
4ae388
+	if (!mpp || !mpp->pg)
4ae388
+		return;
4ae388
+
4ae388
+	vector_foreach_slot (mpp->pg, pgp, i) {
4ae388
+		if (!pgp->paths)
4ae388
+			continue;
4ae388
+		vector_foreach_slot(pgp->paths, pp, j) {
4ae388
+			if (!pp->udev)
4ae388
+				continue;
4ae388
+			sysfs_attr_set_value(pp->udev, "uevent", "change",
4ae388
+					     strlen("change"));
4ae388
+		}
4ae388
+	}
4ae388
+}
4ae388
+
4ae388
+
4ae388
 /*
4ae388
  * Return value:
4ae388
  */
4ae388
@@ -658,8 +682,10 @@ domap (struct multipath * mpp, char * pa
4ae388
 		 * DM_DEVICE_CREATE, DM_DEVICE_RENAME, or DM_DEVICE_RELOAD
4ae388
 		 * succeeded
4ae388
 		 */
4ae388
-		if (mpp->action == ACT_CREATE)
4ae388
-			remember_wwid(mpp->wwid);
4ae388
+		if (mpp->action == ACT_CREATE) {
4ae388
+			if (remember_wwid(mpp->wwid) == 1)
4ae388
+				trigger_uevents(mpp);
4ae388
+		}
4ae388
 		if (!conf->daemon) {
4ae388
 			/* multipath client mode */
4ae388
 			dm_switchgroup(mpp->alias, mpp->bestpg);
4ae388
Index: multipath-tools-130222/libmultipath/wwids.c
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/wwids.c
4ae388
+++ multipath-tools-130222/libmultipath/wwids.c
4ae388
@@ -310,7 +310,7 @@ remember_wwid(char *wwid)
4ae388
 	}
4ae388
 	else
4ae388
 		condlog(4, "wwid %s already in wwids file", wwid);
4ae388
-	return 0;
4ae388
+	return ret;
4ae388
 }
4ae388
 
4ae388
 int remember_cmdline_wwid(void)
4ae388
@@ -344,7 +344,7 @@ int remember_cmdline_wwid(void)
4ae388
 			next++;
4ae388
 		}
4ae388
 		if (strlen(ptr)) {
4ae388
-			if (remember_wwid(ptr) != 0)
4ae388
+			if (remember_wwid(ptr) < 0)
4ae388
 				ret = -1;
4ae388
 		}
4ae388
 		else {
4ae388
Index: multipath-tools-130222/multipath/main.c
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/multipath/main.c
4ae388
+++ multipath-tools-130222/multipath/main.c
4ae388
@@ -303,7 +303,7 @@ configure (void)
4ae388
 		}
4ae388
 		if (conf->cmd == CMD_ADD_WWID) {
4ae388
 			r = remember_wwid(refwwid);
4ae388
-			if (r == 0)
4ae388
+			if (r >= 0)
4ae388
 				printf("wwid '%s' added\n", refwwid);
4ae388
 			else
4ae388
 				printf("failed adding '%s' to wwids file\n",
4ae388
Index: multipath-tools-130222/libmultipath/configure.h
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/configure.h
4ae388
+++ multipath-tools-130222/libmultipath/configure.h
4ae388
@@ -31,3 +31,4 @@ int coalesce_paths (struct vectors *vecs
4ae388
 int get_refwwid (char * dev, enum devtypes dev_type, vector pathvec, char **wwid);
4ae388
 int reload_map(struct vectors *vecs, struct multipath *mpp, int refresh);
4ae388
 int sysfs_get_host_adapter_name(struct path *pp, char *adapter_name);
4ae388
+void trigger_uevents (struct multipath *mpp);
4ae388
Index: multipath-tools-130222/multipathd/main.c
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/multipathd/main.c
4ae388
+++ multipath-tools-130222/multipathd/main.c
4ae388
@@ -1435,7 +1435,8 @@ configure (struct vectors * vecs, int st
4ae388
 
4ae388
 	sync_maps_state(mpvec);
4ae388
 	vector_foreach_slot(mpvec, mpp, i){
4ae388
-		remember_wwid(mpp->wwid);
4ae388
+		if (remember_wwid(mpp->wwid) > 0)
4ae388
+			trigger_uevents(mpp);
4ae388
 		update_map_pr(mpp);
4ae388
 	}
4ae388