summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorKaushal M <kaushal@redhat.com>2013-09-04 16:19:01 +0530
committerAtin Mukherjee <amukherj@redhat.com>2016-03-22 04:41:58 -0700
commit2eb8758bbc88b182bf0e33506b8352cd82c7ec2e (patch)
treee3bb9a1d467d348bc5542f06dfef0fa5eeb4c00a /xlators/mgmt
parent68665d0fc4a827e9933b94da8c4a2977b1a5cee6 (diff)
glusterd: Fix connected clients check during 'volume set'
Use the volume's newly calulatedclient-op-version for the connected clients check. This prevents rejection of server options of higher op-version when clients of lower op-version are connected. Also, initialize the variables of the newly calculated volume op-version and client-op-version with the current values, instead of the cluster op-version. Change-Id: Ieb36f97c677a5457feba54bef20e154c0456e70e BUG: 1004332 Signed-off-by: Kaushal M <kaushal@redhat.com> Reviewed-on: http://review.gluster.org/5786 Tested-by: Atin Mukherjee <amukherj@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Atin Mukherjee <amukherj@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c76
1 files changed, 41 insertions, 35 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 717959b662b..eda840a0483 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -861,35 +861,36 @@ out:
static int
glusterd_op_stage_set_volume (dict_t *dict, char **op_errstr)
{
- int ret = -1;
- char *volname = NULL;
- int exists = 0;
- char *key = NULL;
- char *key_fixed = NULL;
- char *value = NULL;
- char *val_dup = NULL;
- char str[100] = {0, };
- char *trash_path = NULL;
- int trash_path_len = 0;
- int count = 0;
- int dict_count = 0;
- char errstr[PATH_MAX] = {0, };
- glusterd_volinfo_t *volinfo = NULL;
- glusterd_brickinfo_t *brickinfo = NULL;
- dict_t *val_dict = NULL;
- gf_boolean_t global_opt = _gf_false;
- glusterd_volinfo_t *voliter = NULL;
- glusterd_conf_t *priv = NULL;
- xlator_t *this = NULL;
- uint32_t new_op_version = 0;
- uint32_t local_new_op_version = 0;
- uint32_t key_op_version = 0;
- uint32_t local_key_op_version = 0;
- gf_boolean_t origin_glusterd = _gf_true;
- gf_boolean_t check_op_version = _gf_true;
- gf_boolean_t trash_enabled = _gf_false;
- gf_boolean_t all_vol = _gf_false;
- struct stat stbuf = {0, };
+ int ret = -1;
+ char *volname = NULL;
+ int exists = 0;
+ char *key = NULL;
+ char *key_fixed = NULL;
+ char *value = NULL;
+ char *val_dup = NULL;
+ char str[100] = {0, };
+ char *trash_path = NULL;
+ int trash_path_len = 0;
+ int count = 0;
+ int dict_count = 0;
+ char errstr[PATH_MAX] = {0, };
+ glusterd_volinfo_t *volinfo = NULL;
+ glusterd_brickinfo_t *brickinfo = NULL;
+ dict_t *val_dict = NULL;
+ gf_boolean_t global_opt = _gf_false;
+ glusterd_volinfo_t *voliter = NULL;
+ glusterd_conf_t *priv = NULL;
+ xlator_t *this = NULL;
+ uint32_t new_op_version = GD_OP_VERSION_MIN;
+ uint32_t local_new_op_version = GD_OP_VERSION_MIN;
+ uint32_t local_new_client_op_version = GD_OP_VERSION_MIN;
+ uint32_t key_op_version = GD_OP_VERSION_MIN;
+ uint32_t local_key_op_version = GD_OP_VERSION_MIN;
+ gf_boolean_t origin_glusterd = _gf_true;
+ gf_boolean_t check_op_version = _gf_true;
+ gf_boolean_t trash_enabled = _gf_false;
+ gf_boolean_t all_vol = _gf_false;
+ struct stat stbuf = {0, };
GF_ASSERT (dict);
this = THIS;
@@ -1003,12 +1004,14 @@ glusterd_op_stage_set_volume (dict_t *dict, char **op_errstr)
ret = glusterd_validate_volume_id (dict, volinfo);
if (ret)
goto out;
+
+ local_new_op_version = volinfo->op_version;
+ local_new_client_op_version = volinfo->client_op_version;
+
} else {
all_vol = _gf_true;
}
- local_new_op_version = priv->op_version;
-
for ( count = 1; ret != 1 ; count++ ) {
global_opt = _gf_false;
sprintf (str, "key%d", count);
@@ -1166,6 +1169,9 @@ glusterd_op_stage_set_volume (dict_t *dict, char **op_errstr)
local_key_op_version = glusterd_get_op_version_for_key (key);
if (local_key_op_version > local_new_op_version)
local_new_op_version = local_key_op_version;
+ if (gd_is_client_option (key) &&
+ (local_key_op_version > local_new_client_op_version))
+ local_new_client_op_version = local_key_op_version;
sprintf (str, "op-version%d", count);
if (origin_glusterd) {
@@ -1346,10 +1352,10 @@ glusterd_op_stage_set_volume (dict_t *dict, char **op_errstr)
}
}
- // Check if all the connected clients support the new op-version
- ret = glusterd_check_client_op_version_support (volname,
- local_new_op_version,
- op_errstr);
+ /* Check if all the connected clients support the new client-op-version
+ */
+ ret = glusterd_check_client_op_version_support
+ (volname, local_new_client_op_version, op_errstr);
if (ret)
goto out;