Blob Blame History Raw
From bab10010daf3dc93492e7770e4084f0f422e3b0c Mon Sep 17 00:00:00 2001
From: Atin Mukherjee <amukherj@redhat.com>
Date: Mon, 29 Jan 2018 10:23:52 +0530
Subject: [PATCH 145/148] glusterd: optimize glusterd import volumes code path

In case there's a version mismatch detected for one of the volumes
glusterd was ending up with updating all the volumes which is a
overkill.

>upstream mainline patch : https://review.gluster.org/#/c/19358/

Change-Id: I6df792db391ce3a1697cfa9260f7dbc3f59aa62d
BUG: 1540600
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/129935
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
---
 xlators/mgmt/glusterd/src/glusterd-utils.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 4bb54db..d991a9f 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -4819,16 +4819,18 @@ glusterd_compare_friend_data (dict_t *peer_data, int32_t *status,
                         ret = 0;
                         goto out;
                 }
-                if (GLUSTERD_VOL_COMP_UPDATE_REQ == *status)
+                if (GLUSTERD_VOL_COMP_UPDATE_REQ == *status) {
+                        ret = glusterd_import_friend_volume (peer_data, i);
+                        if (ret) {
+                                goto out;
+                        }
                         update = _gf_true;
-
+                        *status = GLUSTERD_VOL_COMP_NONE;
+                }
                 i++;
         }
 
         if (update) {
-                ret = glusterd_import_friend_volumes (peer_data);
-                if (ret)
-                        goto out;
                 glusterd_svcs_manager (NULL);
         }
 
-- 
1.8.3.1