233933
From d7795a592883cfb01da76b6905a7c9eb1e912bef Mon Sep 17 00:00:00 2001
233933
From: Mohit Agrawal <moagrawa@redhat.com>
233933
Date: Tue, 28 May 2019 08:28:29 +0530
233933
Subject: [PATCH 147/169] glusterd: bulkvoldict thread is not handling all
233933
 volumes
233933
233933
Problem: In commit ac70f66c5805e10b3a1072bd467918730c0aeeb4 I
233933
         missed one condition to populate volume dictionary in
233933
         multiple threads while brick_multiplex is enabled.Due
233933
         to that glusterd is not sending volume dictionary for
233933
         all volumes to peer.
233933
233933
Solution: Update the condition in code as well as update test case
233933
          also to avoid the issue
233933
233933
> Change-Id: I06522dbdfee4f7e995d9cc7b7098fdf35340dc52
233933
> fixes: bz#1711250
233933
> Cherry pick from commit 4a5fb52eb1c5387a0fb8bfa1253e5227c7c255e8
233933
> Reviewed on upstream link https://review.gluster.org/#/c/glusterfs/+/22739/
233933
233933
BUG: 1711249
233933
Change-Id: I06522dbdfee4f7e995d9cc7b7098fdf35340dc52
233933
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
233933
Reviewed-on: https://code.engineering.redhat.com/gerrit/171589
233933
Tested-by: RHGS Build Bot <nigelb@redhat.com>
233933
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
233933
---
233933
 tests/bugs/glusterd/bug-1699339.t          | 16 ++++++++++------
233933
 xlators/mgmt/glusterd/src/glusterd-utils.c |  2 +-
233933
 2 files changed, 11 insertions(+), 7 deletions(-)
233933
233933
diff --git a/tests/bugs/glusterd/bug-1699339.t b/tests/bugs/glusterd/bug-1699339.t
233933
index 3e950f4..bb8d4f4 100644
233933
--- a/tests/bugs/glusterd/bug-1699339.t
233933
+++ b/tests/bugs/glusterd/bug-1699339.t
233933
@@ -52,18 +52,22 @@ done
233933
 
233933
 TEST kill_glusterd 1
233933
 
233933
-vol1=$(printf "%s-vol%02d" $V0 1)
233933
+TESTS_EXPECTED_IN_LOOP=4
233933
+for i in `seq 1 3 15`
233933
+do
233933
+vol1=$(printf "%s-vol%02d" $V0 $i)
233933
 TEST $CLI_2 volume set $vol1 performance.readdir-ahead on
233933
-vol2=$(printf "%s-vol%02d" $V0 2)
233933
-TEST $CLI_2 volume set $vol2 performance.readdir-ahead on
233933
+done
233933
 
233933
 # Bring back 1st glusterd
233933
 TEST $glusterd_1
233933
 EXPECT_WITHIN $PROBE_TIMEOUT 2 peer_count
233933
 
233933
+TESTS_EXPECTED_IN_LOOP=4
233933
+for i in `seq 1 3 15`
233933
+do
233933
+vol1=$(printf "%s-vol%02d" $V0 $i)
233933
 EXPECT_WITHIN $PROBE_TIMEOUT "on" volinfo_field_1 $vol1 performance.readdir-ahead
233933
-
233933
-vol_name=$(printf "%s-vol%02d" $V0 2)
233933
-EXPECT_WITHIN $PROBE_TIMEOUT "on" volinfo_field_1 $vol2 performance.readdir-ahead
233933
+done
233933
 
233933
 cleanup
233933
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
233933
index efa5a86..8f1525e 100644
233933
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
233933
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
233933
@@ -3542,7 +3542,7 @@ glusterd_add_volumes_to_export_dict(dict_t **peer_data)
233933
             if ((i + 1) != totthread) {
233933
                 arg->end = ((i + 1) * vol_per_thread_limit);
233933
             } else {
233933
-                arg->end = ((i * vol_per_thread_limit) + endindex);
233933
+                arg->end = (((i + 1) * vol_per_thread_limit) + endindex);
233933
             }
233933
             th_ret = gf_thread_create_detached(
233933
                 &th_id, glusterd_add_bulk_volumes_create_thread, arg,
233933
-- 
233933
1.8.3.1
233933