[Sheepdog] [PATCH 2/2] sheep: get vdi bitmap logic right in join phase

Liu Yuan namei.unix at gmail.com
Tue Sep 13 10:35:26 CEST 2011


From: Liu Yuan <tailai.ly at taobao.com>

For newly added nodes, they cannot get old vdi information that are created
before it joins. This is because in the join phase, we don't get vdi bitmap
right and just get vdi bitmaps from nodes that are in new node's sd_list. So
the correct way is: (as MORITA Kazutaka suggested)

1 call get_vdi_bitmap_from_sd_list() to get bitmaps from ndoe's sd_list.
2 call get_vdi_bitmap_from(msg->from) to get bitmap from the delivery node.
3 call get_vdi_bitmap_from(msg->nodes) to get bitmaps from the old configuration.

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 sheep/group.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/sheep/group.c b/sheep/group.c
index 89176d5..d968c79 100644
--- a/sheep/group.c
+++ b/sheep/group.c
@@ -879,8 +879,15 @@ static void __sd_deliver(struct cpg_event *cevent)
 		switch (m->op) {
 		case SD_MSG_JOIN:
 			if (((struct join_message *)m)->cluster_status == SD_STATUS_OK)
-				if (sys->status != SD_STATUS_OK)
+				if (sys->status != SD_STATUS_OK) {
+					struct join_message *msg = (struct join_message *)m;
+					int i;
+
 					get_vdi_bitmap_from_sd_list();
+					get_vdi_bitmap_from(&m->from);
+					for (i = 0; i < msg->nr_nodes;i++)
+						get_vdi_bitmap_from(&msg->nodes[i].ent);
+			}
 			break;
 		}
 	}
-- 
1.7.5.1




More information about the sheepdog mailing list