summaryrefslogtreecommitdiffstats
path: root/0135-RHBZ-1299600-path-dev-uevents.patch
blob: fddbe19c538d86983f08fa4631028bc86b642625 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
---
 libmultipath/configure.c |   30 ++++++++++++++++++++++++++++--
 libmultipath/wwids.c     |    4 ++--
 multipath/main.c         |    2 +-
 3 files changed, 31 insertions(+), 5 deletions(-)

Index: multipath-tools-130222/libmultipath/configure.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/configure.c
+++ multipath-tools-130222/libmultipath/configure.c
@@ -38,6 +38,7 @@
 #include "util.h"
 #include "uxsock.h"
 #include "wwids.h"
+#include "sysfs.h"
 
 /* group paths in pg by host adapter
  */
@@ -569,6 +570,29 @@ fail:
 	return 1;
 }
 
+static void
+trigger_uevents (struct multipath *mpp)
+{
+	struct pathgroup * pgp;
+	struct path * pp;
+	int i, j;
+
+	if (!mpp || !mpp->pg)
+		return;
+
+	vector_foreach_slot (mpp->pg, pgp, i) {
+		if (!pgp->paths)
+			continue;
+		vector_foreach_slot(pgp->paths, pp, j) {
+			if (!pp->udev)
+				continue;
+			sysfs_attr_set_value(pp->udev, "uevent", "change",
+					     strlen("change"));
+		}
+	}
+}
+
+
 /*
  * Return value:
  */
@@ -658,8 +682,10 @@ domap (struct multipath * mpp, char * pa
 		 * DM_DEVICE_CREATE, DM_DEVICE_RENAME, or DM_DEVICE_RELOAD
 		 * succeeded
 		 */
-		if (mpp->action == ACT_CREATE)
-			remember_wwid(mpp->wwid);
+		if (mpp->action == ACT_CREATE) {
+			if (remember_wwid(mpp->wwid) == 1)
+				trigger_uevents(mpp);
+		}
 		if (!conf->daemon) {
 			/* multipath client mode */
 			dm_switchgroup(mpp->alias, mpp->bestpg);
Index: multipath-tools-130222/libmultipath/wwids.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/wwids.c
+++ multipath-tools-130222/libmultipath/wwids.c
@@ -310,7 +310,7 @@ remember_wwid(char *wwid)
 	}
 	else
 		condlog(4, "wwid %s already in wwids file", wwid);
-	return 0;
+	return ret;
 }
 
 int remember_cmdline_wwid(void)
@@ -344,7 +344,7 @@ int remember_cmdline_wwid(void)
 			next++;
 		}
 		if (strlen(ptr)) {
-			if (remember_wwid(ptr) != 0)
+			if (remember_wwid(ptr) < 0)
 				ret = -1;
 		}
 		else {
Index: multipath-tools-130222/multipath/main.c
===================================================================
--- multipath-tools-130222.orig/multipath/main.c
+++ multipath-tools-130222/multipath/main.c
@@ -303,7 +303,7 @@ configure (void)
 		}
 		if (conf->cmd == CMD_ADD_WWID) {
 			r = remember_wwid(refwwid);
-			if (r == 0)
+			if (r >= 0)
 				printf("wwid '%s' added\n", refwwid);
 			else
 				printf("failed adding '%s' to wwids file\n",