From: "tang.junhui" <tang.jun...@zte.com.cn>

After filtering and merging, then uevents are processed in
uev_trigger(), firstly, each of merged uevents would be processed one
by one with need_do_map in value of 0. Finally, the node “uev” itself
would be processed with need_do_map in value of 1, which would reload
kernel table, and create or remove the dm device.

Change-Id: Ifb4de0ca36180a8af16729c2f70bc250858877bd
Signed-off-by: tang.junhui <tang.jun...@zte.com.cn>
---
 multipathd/main.c | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/multipathd/main.c b/multipathd/main.c
index 15a6175..0b18f6c 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -1092,6 +1092,7 @@ uev_trigger (struct uevent * uev, void * trigger_data)
 {
        int r = 0;
        struct vectors * vecs;
+       struct uevent *merge_uev, *tmp;
 
        vecs = (struct vectors *)trigger_data;
 
@@ -1123,20 +1124,21 @@ uev_trigger (struct uevent * uev, void * trigger_data)
        }
 
        /*
-        * path add/remove event
+        * path add/remove/change event, add/remove maybe merged
         */
-       if (!strncmp(uev->action, "add", 3)) {
-               r = uev_add_path(uev, vecs, 1);
-               goto out;
-       }
-       if (!strncmp(uev->action, "remove", 6)) {
-               r = uev_remove_path(uev, vecs, 1);
-               goto out;
-       }
-       if (!strncmp(uev->action, "change", 6)) {
-               r = uev_update_path(uev, vecs);
-               goto out;
-       }
+       list_for_each_entry_safe(merge_uev, tmp, &uev->merge_node, node) {
+               if (!strncmp(merge_uev->action, "add", 3))
+                       r += uev_add_path(merge_uev, vecs, 0);
+               if (!strncmp(merge_uev->action, "remove", 6))
+                       r += uev_remove_path(merge_uev, vecs, 0);
+       }
+
+       if (!strncmp(uev->action, "add", 3))
+               r += uev_add_path(uev, vecs, 1);
+       if (!strncmp(uev->action, "remove", 6))
+               r += uev_remove_path(uev, vecs, 1);
+       if (!strncmp(uev->action, "change", 6))
+               r += uev_update_path(uev, vecs);
 
 out:
        return r;
-- 
2.8.1.windows.1



--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

Reply via email to