Make sure a newly joining node has the correct number of copies.

Signed-off-by: Christoph Hellwig <[email protected]>

---
 sheep/group.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

Index: sheepdog/sheep/group.c
===================================================================
--- sheepdog.orig/sheep/group.c 2012-07-18 09:54:10.000000000 +0200
+++ sheepdog/sheep/group.c      2012-07-18 09:56:07.170032295 +0200
@@ -487,6 +487,12 @@ static int cluster_sanity_check(struct j
 {
        uint64_t local_ctime = get_cluster_ctime();
        uint32_t local_epoch = get_latest_epoch();
+       uint8_t local_nr_copies;
+
+       if (get_cluster_copies(&local_nr_copies)) {
+               eprintf("failed to get nr_copies\n");
+               return CJ_RES_FAIL;
+       }
 
        if (jm->ctime != local_ctime) {
                eprintf("joining node ctime doesn't match: %"
@@ -502,6 +508,12 @@ static int cluster_sanity_check(struct j
                return CJ_RES_FAIL;
        }
 
+       if (jm->nr_copies != local_nr_copies) {
+               eprintf("joining node nr_copies doesn't match: %u vs %u\n",
+                       jm->nr_copies, local_nr_copies);
+               return CJ_RES_FAIL;
+       }
+
        return CJ_RES_SUCCESS;
 }
 

-- 
sheepdog mailing list
[email protected]
http://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to