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