[Sheepdog] [PATCH 05/14] avoid calling update_cluster_info() in worker threads

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Sat May 14 09:03:50 CEST 2011


update_cluster_info() updates global variables, so we can this
function only in main thread.

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 sheep/group.c |   23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/sheep/group.c b/sheep/group.c
index ae7b385..2826db3 100644
--- a/sheep/group.c
+++ b/sheep/group.c
@@ -823,17 +823,6 @@ static void __sd_deliver(struct cpg_event *cevent)
 			break;
 		}
 	}
-
-	if (m->state == DM_FIN) {
-		switch (m->op) {
-		case SD_MSG_JOIN:
-			update_cluster_info((struct join_message *)m);
-			break;
-		default:
-			eprintf("unknown message %d\n", m->op);
-			break;
-		}
-	}
 }
 
 static void send_join_response(struct work_deliver *w)
@@ -854,6 +843,18 @@ static void __sd_deliver_done(struct cpg_event *cevent)
 	int do_recovery;
 
 	m = w->msg;
+
+	if (m->state == DM_FIN) {
+		switch (m->op) {
+		case SD_MSG_JOIN:
+			update_cluster_info((struct join_message *)m);
+			break;
+		default:
+			eprintf("unknown message %d\n", m->op);
+			break;
+		}
+	}
+
 	do_recovery = (m->state == DM_FIN && m->op == SD_MSG_JOIN);
 
 	dprintf("op: %d, state: %u, size: %d, from: %s\n",
-- 
1.5.6.5




More information about the sheepdog mailing list