summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt/glusterd/src')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c41
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-set.c1
2 files changed, 35 insertions, 7 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index 59d1eceb182..30d22fadbf4 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -3787,17 +3787,44 @@ client_graph_set_rda_options (volgen_graph_t *graph,
!glusterd_volinfo_get_boolean (volinfo, VKEY_READDIR_AHEAD))
goto out;
- ret = glusterd_volinfo_get (volinfo, VKEY_RDA_CACHE_LIMIT, &rda_cache_s);
- if (ret < 0)
+ /* glusterd_volinfo_get() will get the default value if nothing set
+ * explicitly. Hence it is important to check set_dict before checking
+ * glusterd_volinfo_get, so that we consider key value of the in
+ * progress volume set option.
+ */
+ ret = dict_get_str (set_dict, VKEY_RDA_CACHE_LIMIT, &rda_cache_s);
+ if (ret < 0) {
+ ret = glusterd_volinfo_get (volinfo, VKEY_RDA_CACHE_LIMIT,
+ &rda_cache_s);
+ if (ret < 0)
+ goto out;
+ }
+ ret = gf_string2bytesize_uint64 (rda_cache_s, &rda_cache_size);
+ if (ret < 0) {
+ set_graph_errstr (graph, "invalid number format in option "
+ VKEY_RDA_CACHE_LIMIT);
goto out;
+ }
- gf_string2bytesize_uint64 (rda_cache_s, &rda_cache_size);
-
- ret = glusterd_volinfo_get (volinfo, VKEY_RDA_REQUEST_SIZE, &rda_req_s);
- if (ret < 0)
+ ret = dict_get_str (set_dict, VKEY_RDA_REQUEST_SIZE, &rda_req_s);
+ if (ret < 0) {
+ ret = glusterd_volinfo_get (volinfo, VKEY_RDA_REQUEST_SIZE,
+ &rda_req_s);
+ if (ret < 0)
+ goto out;
+ }
+ gf_string2bytesize_uint64 (rda_req_s, &rda_req_size);
+ if (ret < 0) {
+ set_graph_errstr (graph, "invalid number format in option "
+ VKEY_RDA_REQUEST_SIZE);
goto out;
+ }
- gf_string2bytesize_uint64 (rda_req_s, &rda_req_size);
+ if (rda_cache_size == 0 || rda_req_size == 0) {
+ set_graph_errstr (graph, "Value cannot be 0");
+ ret = -1;
+ goto out;
+ }
new_cache_size = rda_cache_size / dist_count;
if (new_cache_size < rda_req_size) {
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
index 8fb5042b4d1..ca32552fb0d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
@@ -3137,6 +3137,7 @@ struct volopt_map_entry glusterd_volopt_map[] = {
.value = "off",
.type = DOC,
.op_version = GD_OP_VERSION_3_10_0,
+ .validate_fn = validate_boolean,
.description = "If this option is enabled, the readdir operation is "
"performed parallely on all the bricks, thus improving"
" the performance of readdir. Note that the performance"