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

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