[sheepdog] [PATCH v2 5/9] sheep: simplify cluster_sanity_check

MORITA Kazutaka morita.kazutaka at gmail.com
Fri Jul 12 22:25:55 CEST 2013


From: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>

It is enough to check the cluster creation time to detect wrong node
joining.

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 sheep/group.c |   18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/sheep/group.c b/sheep/group.c
index d58f097..bec0b74 100644
--- a/sheep/group.c
+++ b/sheep/group.c
@@ -386,7 +386,7 @@ int epoch_log_read_remote(uint32_t epoch, struct sd_node *nodes, int len,
 	return 0;
 }
 
-static int cluster_sanity_check(struct join_message *jm)
+static int cluster_ctime_check(const struct join_message *jm)
 {
 	if (jm->cinfo.ctime != sys->cinfo.ctime) {
 		sd_eprintf("joining node ctime doesn't match: %"
@@ -395,18 +395,6 @@ static int cluster_sanity_check(struct join_message *jm)
 		return CJ_RES_FAIL;
 	}
 
-	if (jm->cinfo.nr_copies != sys->cinfo.nr_copies) {
-		sd_eprintf("joining node nr_copies doesn't match: %u vs %u",
-			   jm->cinfo.nr_copies, sys->cinfo.nr_copies);
-		return CJ_RES_FAIL;
-	}
-
-	if (jm->cinfo.flags != sys->cinfo.flags) {
-		sd_eprintf("joining node cluster_flags don't match: %u vs %u",
-			   jm->cinfo.flags, sys->cinfo.flags);
-		return CJ_RES_FAIL;
-	}
-
 	return CJ_RES_SUCCESS;
 }
 
@@ -444,7 +432,7 @@ static int cluster_wait_for_join_check(const struct sd_node *joining,
 
 	if (jm->cinfo.epoch != 0 && sys->cinfo.epoch != 0) {
 		/* check whether joining node is valid or not */
-		ret = cluster_sanity_check(jm);
+		ret = cluster_ctime_check(jm);
 		if (ret != CJ_RES_SUCCESS)
 			return ret;
 	}
@@ -481,7 +469,7 @@ static int cluster_running_check(struct join_message *jm)
 	 * join we do not need to check anything.
 	 */
 	if (jm->cinfo.nr_nodes != 0) {
-		ret = cluster_sanity_check(jm);
+		ret = cluster_ctime_check(jm);
 		if (ret != CJ_RES_SUCCESS)
 			return ret;
 	}
-- 
1.7.9.5




More information about the sheepdog mailing list