You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

122 lines
3.5 KiB

---
libmultipath/configure.c | 30 ++++++++++++++++++++++++++++--
libmultipath/configure.h | 1 +
libmultipath/wwids.c | 4 ++--
multipath/main.c | 2 +-
multipathd/main.c | 3 ++-
5 files changed, 34 insertions(+), 6 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;
}
+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",
Index: multipath-tools-130222/libmultipath/configure.h
===================================================================
--- multipath-tools-130222.orig/libmultipath/configure.h
+++ multipath-tools-130222/libmultipath/configure.h
@@ -31,3 +31,4 @@ int coalesce_paths (struct vectors *vecs
int get_refwwid (char * dev, enum devtypes dev_type, vector pathvec, char **wwid);
int reload_map(struct vectors *vecs, struct multipath *mpp, int refresh);
int sysfs_get_host_adapter_name(struct path *pp, char *adapter_name);
+void trigger_uevents (struct multipath *mpp);
Index: multipath-tools-130222/multipathd/main.c
===================================================================
--- multipath-tools-130222.orig/multipathd/main.c
+++ multipath-tools-130222/multipathd/main.c
@@ -1435,7 +1435,8 @@ configure (struct vectors * vecs, int st
sync_maps_state(mpvec);
vector_foreach_slot(mpvec, mpp, i){
- remember_wwid(mpp->wwid);
+ if (remember_wwid(mpp->wwid) > 0)
+ trigger_uevents(mpp);
update_map_pr(mpp);
}