From 2d87a981657ee23d00c20813deddeb320e0afa8f Mon Sep 17 00:00:00 2001 From: Gaurav Kumar Garg Date: Mon, 7 Mar 2016 13:37:31 +0530 Subject: glusterd: avoid setting op-version lower than current cluster op-version Currently glusterd allow setting a cluster op-version which is lower than current cluster op-version. Though command is successful but it does not set that lower op-version. With this fix it will return error message "Required op-version (requested op-version) should not be lower than current cluster op-version (current cluster op-version)" Change-Id: Ia5b61858ee22a5a26721ec12ab12ff48e1a40c82 BUG: 1315186 Signed-off-by: Gaurav Kumar Garg Reviewed-on: http://review.gluster.org/13622 Smoke: Gluster Build System CentOS-regression: Gluster Build System NetBSD-regression: NetBSD Build System Reviewed-by: Atin Mukherjee --- xlators/mgmt/glusterd/src/glusterd-op-sm.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index ea1400d7637..05b59950da6 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -1138,8 +1138,22 @@ glusterd_op_stage_set_volume (dict_t *dict, char **op_errstr) "%s", errstr); goto out; } - if (local_key_op_version > local_new_op_version) + if (local_key_op_version > local_new_op_version) { local_new_op_version = local_key_op_version; + } else { + ret = -1; + snprintf (errstr, sizeof (errstr), + "Required op-version (%d) should" + " not be equal or lower than current" + " cluster op-version (%d).", + local_key_op_version, + local_new_op_version); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VERSION_UNSUPPORTED, + "%s", errstr); + goto out; + } + goto cont; } -- cgit