12a457
From cf2a4eb499d8e15fd745704295c317b2225203bc Mon Sep 17 00:00:00 2001
12a457
From: Kotresh HR <khiremat@redhat.com>
12a457
Date: Wed, 20 Apr 2016 23:49:39 +0530
12a457
Subject: [PATCH 111/139] glusterd/bitrot: Fix bit-rot scrub status
12a457
12a457
Few of the dictionary values were not allocated and
12a457
set. This patch allocates them and set.
12a457
12a457
Upstream master:
12a457
>Change-Id: Ic61c1209b238e45219793fd8bec92235adfbd013
12a457
>BUG: 1329211
12a457
>Reviewed-on: http://review.gluster.org/14120
12a457
12a457
Upstream release-3.7:
12a457
>Change-Id: Icf52a98a9699c6bd0b2dff159626f87030c76d72
12a457
>BUG: 1332072
12a457
>Reviewed-on: http://review.gluster.org/14141
12a457
12a457
Change-Id: Iea340634049fa48da6f498959133daa698a75c5c
12a457
BUG: 1299737
12a457
Signed-off-by: Kotresh HR <khiremat@redhat.com>
12a457
Reviewed-on: https://code.engineering.redhat.com/gerrit/73574
12a457
Reviewed-by: Venky Shankar <vshankar@redhat.com>
12a457
Tested-by: Venky Shankar <vshankar@redhat.com>
12a457
---
12a457
 xlators/mgmt/glusterd/src/glusterd-utils.c |   18 +++++++++++-------
12a457
 1 files changed, 11 insertions(+), 7 deletions(-)
12a457
12a457
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
12a457
index 1c6541c..8ed9ff1 100644
12a457
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
12a457
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
12a457
@@ -8548,7 +8548,6 @@ glusterd_volume_bitrot_scrub_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict)
12a457
         ret = dict_get_str (rsp_dict, key, &node_uuid);
12a457
         if (!ret) {
12a457
                 node_uuid_str = gf_strdup (node_uuid);
12a457
-
12a457
                 memset (key, 0, 256);
12a457
                 snprintf (key, 256, "node-uuid-%d", src_count+dst_count);
12a457
                 ret = dict_set_dynstr (aggr, key, node_uuid_str);
12a457
@@ -8643,7 +8642,8 @@ glusterd_volume_bitrot_scrub_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict)
12a457
 
12a457
         ret = dict_get_str (rsp_dict, "bitrot_log_file", &bitd_log);
12a457
         if (!ret) {
12a457
-                ret = dict_set_str (aggr, "bitrot_log_file", bitd_log);
12a457
+                ret = dict_set_dynstr_with_alloc (aggr, "bitrot_log_file",
12a457
+                                                  bitd_log);
12a457
                 if (ret) {
12a457
                         gf_msg_debug (this->name, 0, "Failed to set "
12a457
                                       "bitrot log file location");
12a457
@@ -8653,7 +8653,8 @@ glusterd_volume_bitrot_scrub_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict)
12a457
 
12a457
         ret = dict_get_str (rsp_dict, "scrub_log_file", &scrub_log);
12a457
         if (!ret) {
12a457
-                ret = dict_set_str (aggr, "scrub_log_file", scrub_log);
12a457
+                ret = dict_set_dynstr_with_alloc (aggr, "scrub_log_file",
12a457
+                                                  scrub_log);
12a457
                 if (ret) {
12a457
                         gf_msg_debug (this->name, 0, "Failed to set "
12a457
                                       "scrubber log file location");
12a457
@@ -8663,7 +8664,8 @@ glusterd_volume_bitrot_scrub_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict)
12a457
 
12a457
         ret = dict_get_str (rsp_dict, "features.scrub-freq", &scrub_freq);
12a457
         if (!ret) {
12a457
-                ret = dict_set_str (aggr, "features.scrub-freq", scrub_freq);
12a457
+                ret = dict_set_dynstr_with_alloc (aggr, "features.scrub-freq",
12a457
+                                                  scrub_freq);
12a457
                 if (ret) {
12a457
                         gf_msg_debug (this->name, 0, "Failed to set "
12a457
                                       "scrub-frequency value to dictionary");
12a457
@@ -8673,8 +8675,9 @@ glusterd_volume_bitrot_scrub_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict)
12a457
 
12a457
         ret = dict_get_str (rsp_dict, "features.scrub-throttle", &scrub_impact);
12a457
         if (!ret) {
12a457
-                ret = dict_set_str (aggr, "features.scrub-throttle",
12a457
-                                    scrub_impact);
12a457
+                ret = dict_set_dynstr_with_alloc (aggr,
12a457
+                                                  "features.scrub-throttle",
12a457
+                                                  scrub_impact);
12a457
                 if (ret) {
12a457
                         gf_msg_debug (this->name, 0, "Failed to set "
12a457
                                       "scrub-throttle value to dictionary");
12a457
@@ -8684,7 +8687,8 @@ glusterd_volume_bitrot_scrub_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict)
12a457
 
12a457
         ret = dict_get_str (rsp_dict, "features.scrub", &scrub_state);
12a457
         if (!ret) {
12a457
-                ret = dict_set_str (aggr, "features.scrub", scrub_state);
12a457
+                ret = dict_set_dynstr_with_alloc (aggr, "features.scrub",
12a457
+                                                  scrub_state);
12a457
                 if (ret) {
12a457
                         gf_msg_debug (this->name, 0, "Failed to set "
12a457
                                       "scrub state value to dictionary");
12a457
-- 
12a457
1.7.1
12a457