diff options
Diffstat (limited to 'meta-oe/recipes-support/multipath-tools/files/0007-RH-trigger-change-uevent-on-new-device-creation.patch')
-rw-r--r-- | meta-oe/recipes-support/multipath-tools/files/0007-RH-trigger-change-uevent-on-new-device-creation.patch | 138 |
1 files changed, 138 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/multipath-tools/files/0007-RH-trigger-change-uevent-on-new-device-creation.patch b/meta-oe/recipes-support/multipath-tools/files/0007-RH-trigger-change-uevent-on-new-device-creation.patch new file mode 100644 index 000000000..025a3512e --- /dev/null +++ b/meta-oe/recipes-support/multipath-tools/files/0007-RH-trigger-change-uevent-on-new-device-creation.patch | |||
@@ -0,0 +1,138 @@ | |||
1 | From 0d2c9afbd89d79fd700f9c99aa20e5f7c7382027 Mon Sep 17 00:00:00 2001 | ||
2 | From: Benjamin Marzinski <bmarzins@redhat.com> | ||
3 | Date: Mon, 24 Apr 2017 09:39:57 -0500 | ||
4 | Subject: [PATCH 07/14] RH: trigger change uevent on new device creation | ||
5 | |||
6 | When multipath first sees a path device with user_friendly names | ||
7 | enabled, it can't know if the device should be multipathed. This means | ||
8 | that it will not claim the device in udev. If the device is eventually | ||
9 | multipathed, multipath should trigger a change uevent to update the udev | ||
10 | database to claim the device. | ||
11 | |||
12 | This also reverts commit 64e27ec066a001012f44550f095c93443e91d845. | ||
13 | |||
14 | Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com> | ||
15 | --- | ||
16 | libmultipath/configure.c | 26 ++++++++++++++++++++++++-- | ||
17 | libmultipath/configure.h | 1 + | ||
18 | libmultipath/wwids.c | 4 ++-- | ||
19 | multipath/main.c | 2 +- | ||
20 | multipathd/main.c | 7 ++----- | ||
21 | 5 files changed, 30 insertions(+), 10 deletions(-) | ||
22 | |||
23 | diff --git a/libmultipath/configure.c b/libmultipath/configure.c | ||
24 | index bd090d9..843dd09 100644 | ||
25 | --- a/libmultipath/configure.c | ||
26 | +++ b/libmultipath/configure.c | ||
27 | @@ -422,6 +422,28 @@ trigger_udev_change(const struct multipath *mpp) | ||
28 | udev_device_unref(udd); | ||
29 | } | ||
30 | |||
31 | +void | ||
32 | +trigger_paths_udev_change(const struct multipath *mpp) | ||
33 | +{ | ||
34 | + struct pathgroup * pgp; | ||
35 | + struct path * pp; | ||
36 | + int i, j; | ||
37 | + | ||
38 | + if (!mpp || !mpp->pg) | ||
39 | + return; | ||
40 | + | ||
41 | + vector_foreach_slot (mpp->pg, pgp, i) { | ||
42 | + if (!pgp->paths) | ||
43 | + continue; | ||
44 | + vector_foreach_slot(pgp->paths, pp, j) { | ||
45 | + if (!pp->udev) | ||
46 | + continue; | ||
47 | + sysfs_attr_set_value(pp->udev, "uevent", "change", | ||
48 | + strlen("change")); | ||
49 | + } | ||
50 | + } | ||
51 | +} | ||
52 | + | ||
53 | static int | ||
54 | is_mpp_known_to_udev(const struct multipath *mpp) | ||
55 | { | ||
56 | @@ -802,8 +824,8 @@ int domap(struct multipath *mpp, char *params, int is_daemon) | ||
57 | * succeeded | ||
58 | */ | ||
59 | mpp->force_udev_reload = 0; | ||
60 | - if (mpp->action == ACT_CREATE) | ||
61 | - remember_wwid(mpp->wwid); | ||
62 | + if (mpp->action == ACT_CREATE && remember_wwid(mpp->wwid) == 1) | ||
63 | + trigger_paths_udev_change(mpp); | ||
64 | if (!is_daemon) { | ||
65 | /* multipath client mode */ | ||
66 | dm_switchgroup(mpp->alias, mpp->bestpg); | ||
67 | diff --git a/libmultipath/configure.h b/libmultipath/configure.h | ||
68 | index fd7f581..253e29b 100644 | ||
69 | --- a/libmultipath/configure.h | ||
70 | +++ b/libmultipath/configure.h | ||
71 | @@ -36,3 +36,4 @@ int get_refwwid (enum mpath_cmds cmd, char * dev, enum devtypes dev_type, | ||
72 | vector pathvec, char **wwid); | ||
73 | int reload_map(struct vectors *vecs, struct multipath *mpp, int refresh, int is_daemon); | ||
74 | int sysfs_get_host_adapter_name(struct path *pp, char *adapter_name); | ||
75 | +void trigger_paths_udev_change(const struct multipath *mpp); | ||
76 | diff --git a/libmultipath/wwids.c b/libmultipath/wwids.c | ||
77 | index 88bb72b..249c6c1 100644 | ||
78 | --- a/libmultipath/wwids.c | ||
79 | +++ b/libmultipath/wwids.c | ||
80 | @@ -319,7 +319,7 @@ remember_wwid(char *wwid) | ||
81 | condlog(3, "wrote wwid %s to wwids file", wwid); | ||
82 | else | ||
83 | condlog(4, "wwid %s already in wwids file", wwid); | ||
84 | - return 0; | ||
85 | + return ret; | ||
86 | } | ||
87 | |||
88 | int remember_cmdline_wwid(void) | ||
89 | @@ -353,7 +353,7 @@ int remember_cmdline_wwid(void) | ||
90 | next++; | ||
91 | } | ||
92 | if (strlen(ptr)) { | ||
93 | - if (remember_wwid(ptr) != 0) | ||
94 | + if (remember_wwid(ptr) < 0) | ||
95 | ret = -1; | ||
96 | } | ||
97 | else { | ||
98 | diff --git a/multipath/main.c b/multipath/main.c | ||
99 | index 72585b0..2eda6a3 100644 | ||
100 | --- a/multipath/main.c | ||
101 | +++ b/multipath/main.c | ||
102 | @@ -336,7 +336,7 @@ configure (struct config *conf, enum mpath_cmds cmd, | ||
103 | } | ||
104 | if (cmd == CMD_ADD_WWID) { | ||
105 | r = remember_wwid(refwwid); | ||
106 | - if (r == 0) | ||
107 | + if (r >= 0) | ||
108 | printf("wwid '%s' added\n", refwwid); | ||
109 | else | ||
110 | printf("failed adding '%s' to wwids file\n", | ||
111 | diff --git a/multipathd/main.c b/multipathd/main.c | ||
112 | index 81c76ca..874bcce 100644 | ||
113 | --- a/multipathd/main.c | ||
114 | +++ b/multipathd/main.c | ||
115 | @@ -2093,7 +2093,8 @@ configure (struct vectors * vecs, int start_waiters) | ||
116 | |||
117 | sync_maps_state(mpvec); | ||
118 | vector_foreach_slot(mpvec, mpp, i){ | ||
119 | - remember_wwid(mpp->wwid); | ||
120 | + if (remember_wwid(mpp->wwid) == 1) | ||
121 | + trigger_paths_udev_change(mpp); | ||
122 | update_map_pr(mpp); | ||
123 | } | ||
124 | |||
125 | @@ -2175,10 +2176,6 @@ reconfigure (struct vectors * vecs) | ||
126 | conf->verbosity = verbosity; | ||
127 | if (bindings_read_only) | ||
128 | conf->bindings_read_only = bindings_read_only; | ||
129 | - if (conf->find_multipaths) { | ||
130 | - condlog(2, "find_multipaths is set: -n is implied"); | ||
131 | - ignore_new_devs = 1; | ||
132 | - } | ||
133 | if (ignore_new_devs) | ||
134 | conf->ignore_new_devs = ignore_new_devs; | ||
135 | uxsock_timeout = conf->uxsock_timeout; | ||
136 | -- | ||
137 | 2.8.1 | ||
138 | |||