From 50cde2853bd144ff19ac8b6ac06e993cfb734f63 Mon Sep 17 00:00:00 2001 From: anand Date: Thu, 29 Oct 2015 21:36:57 +0530 Subject: glusterd: fix info file checksum mismatch during upgrade issue: probing a new node(>=3.6) from 3.5 cluster is moving the peer to rejected state. fix: Disperse vol support is added from 3.6 release, so write disperse fields (disperse_count=0 and redundancy_count=0) in vol info file only if cluster version supported. Backport of: >Change-Id: I11d5e2e337b9bbaddc8e52ca7295ba481beb1132 >BUG: 1276423 >Signed-off-by: anand >Reviewed-on: http://review.gluster.org/12464 >Reviewed-by: Pranith Kumar Karampuri >Tested-by: Gluster Build System >Reviewed-by: Kaushal M >Tested-by: NetBSD Build System >(cherry picked from commit d29dd0747dbb2e7383867c97cbbaa8c41851db78) Change-Id: I8351457d15e76936851128eb8609746ae87d5aa8 BUG: 1277822 Signed-off-by: anand Reviewed-on: http://review.gluster.org/12501 Tested-by: Gluster Build System Reviewed-by: Atin Mukherjee Reviewed-by: Raghavendra Bhat --- xlators/mgmt/glusterd/src/glusterd-store.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c index 1f31d196af2..ad20d0f3190 100644 --- a/xlators/mgmt/glusterd/src/glusterd-store.c +++ b/xlators/mgmt/glusterd/src/glusterd-store.c @@ -818,11 +818,14 @@ glusterd_volume_exclude_options_write (int fd, glusterd_volinfo_t *volinfo) char buf[PATH_MAX] = ""; int32_t ret = -1; xlator_t *this = NULL; + glusterd_conf_t *conf = NULL; this = THIS; GF_ASSERT (this); GF_ASSERT (fd > 0); GF_ASSERT (volinfo); + conf = this->private; + GF_VALIDATE_OR_GOTO (this->name, (conf != NULL), out); snprintf (buf, sizeof (buf), "%d", volinfo->type); ret = gf_store_save_value (fd, GLUSTERD_STORE_KEY_VOL_TYPE, buf); @@ -855,17 +858,19 @@ glusterd_volume_exclude_options_write (int fd, glusterd_volinfo_t *volinfo) if (ret) goto out; - snprintf (buf, sizeof (buf), "%d", volinfo->disperse_count); - ret = gf_store_save_value (fd, GLUSTERD_STORE_KEY_VOL_DISPERSE_CNT, - buf); - if (ret) - goto out; + if (conf->op_version >= GD_OP_VERSION_3_6_0) { + snprintf (buf, sizeof (buf), "%d", volinfo->disperse_count); + ret = gf_store_save_value (fd, GLUSTERD_STORE_KEY_VOL_DISPERSE_CNT, + buf); + if (ret) + goto out; - snprintf (buf, sizeof (buf), "%d", volinfo->redundancy_count); - ret = gf_store_save_value (fd, GLUSTERD_STORE_KEY_VOL_REDUNDANCY_CNT, - buf); - if (ret) - goto out; + snprintf (buf, sizeof (buf), "%d", volinfo->redundancy_count); + ret = gf_store_save_value (fd, GLUSTERD_STORE_KEY_VOL_REDUNDANCY_CNT, + buf); + if (ret) + goto out; + } snprintf (buf, sizeof (buf), "%d", volinfo->version); ret = gf_store_save_value (fd, GLUSTERD_STORE_KEY_VOL_VERSION, buf); -- cgit