All of lore.kernel.org
 help / color / mirror / Atom feed
From: tang.junhui@zte.com.cn
To: christophe.varoqui@opensvc.com, bmarzins@redhat.com,
	hare@suse.de, mwilck@suse.com, bart.vanassche@sandisk.com
Cc: zhang.kai16@zte.com.cn, dm-devel@redhat.com,
	tang.junhui@zte.com.cn, tang.wenjun3@zte.com.cn
Subject: [PATCH 11/11] multipathd: proccess merged uevents
Date: Thu, 12 Jan 2017 13:52:27 +0800	[thread overview]
Message-ID: <1484200347-11188-12-git-send-email-tang.junhui@zte.com.cn> (raw)
In-Reply-To: <1484200347-11188-1-git-send-email-tang.junhui@zte.com.cn>

From: "tang.junhui" <tang.junhui@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.junhui@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 24116e3..5b63577 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -1120,6 +1120,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;
 
@@ -1151,20 +1152,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

      parent reply	other threads:[~2017-01-12  5:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-12  5:52 [PATCH 00/11] multipath-tools: improve processing efficiency for addition and deletion of multipath devices tang.junhui
2017-01-12  5:52 ` [PATCH 01/11] libmultipath: add merge_id in "struct uevent" for uevents merging tang.junhui
2017-01-12  5:52 ` [PATCH 02/11] libmultipath: add merge_node for "struct uevent" to record nodes of merged uevents tang.junhui
2017-01-12  5:52 ` [PATCH 03/11] libmultipath: add three list iteration macros tang.junhui
2017-01-12  5:52 ` [PATCH 04/11] multipathd: add need_do_map to indicate whether need calling domap() in ev_add_path() tang.junhui
2017-01-16 21:38   ` Benjamin Marzinski
2017-01-17  7:28     ` tang.junhui
2017-01-17 16:14       ` Benjamin Marzinski
2017-04-05 13:26         ` uid_attrs (was Re: [PATCH 04/11] multipathd: add need_do_map to indicate whether need calling domap() in ev_add_path()) Martin Wilck
2017-04-05 18:45           ` Benjamin Marzinski
2017-04-05 20:16             ` Martin Wilck
2017-04-05 23:19               ` Benjamin Marzinski
2017-01-12  5:52 ` [PATCH 05/11] multipathd: add need_do_map to indicate whether need calling domap() in ev_remove_path() tang.junhui
2017-01-16 18:18   ` Benjamin Marzinski
2017-01-12  5:52 ` [PATCH 06/11] multipathd: move uev_discard() to uevent.c and change its name to uevent_can_discard() tang.junhui
2017-01-12  5:52 ` [PATCH 07/11] multipathd: move calling filter_devnode() from uev_trigger() " tang.junhui
2017-01-12  5:52 ` [PATCH 08/11] libmultipath: wait one seconds for more uevents in uevent_listen() in uevents burst situations tang.junhui
2017-01-12  5:52 ` [PATCH 09/11] multipathd: merge uevents before proccessing tang.junhui
2017-01-12  5:52 ` [PATCH 10/11] libmultipath: filter " tang.junhui
2017-01-12  5:52 ` tang.junhui [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1484200347-11188-12-git-send-email-tang.junhui@zte.com.cn \
    --to=tang.junhui@zte.com.cn \
    --cc=bart.vanassche@sandisk.com \
    --cc=bmarzins@redhat.com \
    --cc=christophe.varoqui@opensvc.com \
    --cc=dm-devel@redhat.com \
    --cc=hare@suse.de \
    --cc=mwilck@suse.com \
    --cc=tang.wenjun3@zte.com.cn \
    --cc=zhang.kai16@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.