Blob Blame History Raw
From c2c5f414fc24579eb864a447995c053c4b14413c Mon Sep 17 00:00:00 2001
From: Atin Mukherjee <amukherj@redhat.com>
Date: Thu, 22 Sep 2016 20:04:12 +0530
Subject: [PATCH 91/94] glusterd: fix return val in glusterd_op_volume_dict_uuid_to_hostname ()

glusterd_op_volume_dict_uuid_to_hostname () ignores few dict_get_str failures
but doesn't reset the ret value to 0.

Reproducer steps:
1. Configure a volume and start it (gNFS has to be disabled)
2. gluster volume status

An warning log is observed with:
[MSGID: 106217] [glusterd-op-sm.c:4706:glusterd_op_modify_op_ctx] 0-management:
Failed uuid to hostname conversion
[2016-09-22 09:21:38.537533] W [MSGID: 106387]
[glusterd-op-sm.c:4812:glusterd_op_modify_op_ctx] 0-management: op_ctx
modification failed

>Reviewed-on: http://review.gluster.org/15547
>Smoke: Gluster Build System <jenkins@build.gluster.org>
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
>Reviewed-by: Samikshan Bairagya <samikshan@gmail.com>
>Reviewed-by: Kaushal M <kaushal@redhat.com>

>Reviewed-on: http://review.gluster.org/15571
>Smoke: Gluster Build System <jenkins@build.gluster.org>
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
>Reviewed-by: Prashanth Pai <ppai@redhat.com>

Change-Id: I1d3aa79304d83a9d5db1b7198773d8c2780e24a9
BUG: 1378484
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/85939
---
 xlators/mgmt/glusterd/src/glusterd-op-sm.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 75b809d..1b50038 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -4370,8 +4370,10 @@ glusterd_op_volume_dict_uuid_to_hostname (dict_t *dict, const char *key_fmt,
                 memset (key, 0, sizeof (key));
                 snprintf (key, sizeof (key), key_fmt, i);
                 ret = dict_get_str (dict, key, &uuid_str);
-                if (ret)
+                if (ret) {
+                        ret = 0;
                         continue;
+                }
 
                 gf_msg_debug (this->name, 0, "Got uuid %s",
                         uuid_str);
@@ -4380,8 +4382,10 @@ glusterd_op_volume_dict_uuid_to_hostname (dict_t *dict, const char *key_fmt,
                 /* if parsing fails don't error out
                  * let the original value be retained
                  */
-                if (ret)
+                if (ret) {
+                        ret = 0;
                         continue;
+                }
 
                 hostname = glusterd_uuid_to_hostname (uuid);
                 if (hostname) {
-- 
1.7.1