device-mapper-multipath/0135-RHBZ-1299600-path-dev-uevents.patch
Benjamin Marzinski 906e1e1128 device-mapper-multipath-0.4.9-83
Modify 0135-RHBZ-1299600-path-dev-uevents.patch
  * trigger uevents when adding wwids for existing devices during startup
Refresh 0136-RHBZ-1304687-wait-for-map-add.patch
Refresh 0150-RHBZ-1253913-fix-startup-msg.patch
Modify 0159-UPBZ-1255885-udev-waits.patch
  * fix bug in failure path
Add 0160-RH-udev-flags.patch
Add 0161-RHBZ-1311659-no-kpartx.patch
  * skip_kpartx option disables kpartx running on multipath devices
Add 0162-RHBZ-1333331-huawei-config.patch
  * Add default config for Huawei XSG1 array
Add 0163-UPBZ-1333492-resize-map.patch
  * restore old size if resize fails
Add 0164-RHBZ-1311463-dos-part-rollover.patch
  * fix incorrect partition size due to 4k device size rollover
Add 0165-UPBZ-1341748-MSA-2040-conf.patch
  * Add default config for MSA 2040 array
Add 0166-RHBZ-1323429-dont-allow-new-wwid.patch
  * don't allow path wwid to change while it is in use
Add 0167-RHBZ-1335176-fix-show-cmds.patch
  * and new show multipath format wildcard, 'f' to sho number of failures.
    This will hopefully be useful for tracking what happens to multipath
    devices for bz #1335176
Add 0168-RHBZ-1347769-shared-lock.patch
  * make multipath lock the path devices with a shared lock
Add 0169-UPBZ-1353357-json-output.patch
  * add mulitpathd json output command
Add 0170-UPBZ-1352925-fix-typo.patch
Add 0171-UPBZ-1356651-allow-zero-size.patch
  * Allow zero-sized paths to be added to a multipath device
Add 0172-RHBZ-1350931-no-active-add.patch
  * Allow paths to be added to a new map if no active paths exist. Also
    fixes 1351430
2016-07-22 15:20:02 -05:00

122 lines
3.5 KiB
Diff

---
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);
}