If sheep exits after writing epoch info and before saving config in
cluster_make_fs(), it will send a wrong config to master and fail to
join Sheepdog when it restarts.

This patch saves config before logging epoch info to avoid the
problem.

Signed-off-by: MORITA Kazutaka <[email protected]>
---
 sheep/ops.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sheep/ops.c b/sheep/ops.c
index 74504a8..b4fa77f 100644
--- a/sheep/ops.c
+++ b/sheep/ops.c
@@ -248,6 +248,8 @@ static int cluster_make_fs(const struct sd_req *req, struct 
sd_rsp *rsp,
 
        created_time = hdr->ctime;
        set_cluster_ctime(created_time);
+       set_cluster_copies(sys->nr_copies);
+       set_cluster_flags(sys->flags);
 
        for (i = 1; i <= latest_epoch; i++)
                remove_epoch(i);
@@ -261,8 +263,6 @@ static int cluster_make_fs(const struct sd_req *req, struct 
sd_rsp *rsp,
        if (ret)
                return SD_RES_EIO;
 
-       set_cluster_copies(sys->nr_copies);
-       set_cluster_flags(sys->flags);
        if (have_enough_zones())
                sys->status = SD_STATUS_OK;
        else
-- 
1.7.2.5

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

Reply via email to