|
|
14f8ab |
From bb39abc1dab3c7b7b725f9eefe119218e94f610b Mon Sep 17 00:00:00 2001
|
|
|
14f8ab |
From: Mohit Agrawal <moagrawal@redhat.com>
|
|
|
14f8ab |
Date: Mon, 29 Apr 2019 18:48:36 +0530
|
|
|
14f8ab |
Subject: [PATCH 128/141] glusterd: Fix bulkvoldict thread logic in brick
|
|
|
14f8ab |
multiplexing
|
|
|
14f8ab |
|
|
|
14f8ab |
Problem: Currently glusterd spawn bulkvoldict in brick_mux
|
|
|
14f8ab |
environment while no. of volumes are less than configured
|
|
|
14f8ab |
glusterd.vol_count_per_thread
|
|
|
14f8ab |
|
|
|
14f8ab |
Solution: Correct the logic to spawn bulkvoldict thread
|
|
|
14f8ab |
1) Calculate endindex only while total thread is non zero
|
|
|
14f8ab |
2) Update end index correctly to pass index for bulkvoldict
|
|
|
14f8ab |
thread
|
|
|
14f8ab |
|
|
|
14f8ab |
> Fixes: bz#1704252
|
|
|
14f8ab |
> Change-Id: I1def847fbdd6a605e7687bfc4e42b706bf0eb70b
|
|
|
14f8ab |
> (Cherry picked from commit ac70f66c5805e10b3a1072bd467918730c0aeeb4)
|
|
|
14f8ab |
> (Reviewed on upstream link https://review.gluster.org/#/c/glusterfs/+/22647/)
|
|
|
14f8ab |
|
|
|
14f8ab |
BUG: 1704769
|
|
|
14f8ab |
Change-Id: I1def847fbdd6a605e7687bfc4e42b706bf0eb70b
|
|
|
14f8ab |
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
|
|
|
14f8ab |
Reviewed-on: https://code.engineering.redhat.com/gerrit/169091
|
|
|
14f8ab |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
14f8ab |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
14f8ab |
---
|
|
|
14f8ab |
xlators/mgmt/glusterd/src/glusterd-utils.c | 24 ++++++++++++++++++------
|
|
|
14f8ab |
1 file changed, 18 insertions(+), 6 deletions(-)
|
|
|
14f8ab |
|
|
|
14f8ab |
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
14f8ab |
index ff6102b..efa5a86 100644
|
|
|
14f8ab |
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
14f8ab |
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
14f8ab |
@@ -3436,9 +3436,19 @@ glusterd_add_bulk_volumes_create_thread(void *data)
|
|
|
14f8ab |
cds_list_for_each_entry(volinfo, &priv->volumes, vol_list)
|
|
|
14f8ab |
{
|
|
|
14f8ab |
count++;
|
|
|
14f8ab |
- if ((count < start) || (count > end))
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+ /* Skip volumes if index count is less than start
|
|
|
14f8ab |
+ index to handle volume for specific thread
|
|
|
14f8ab |
+ */
|
|
|
14f8ab |
+ if (count < start)
|
|
|
14f8ab |
continue;
|
|
|
14f8ab |
|
|
|
14f8ab |
+ /* No need to process volume if index count is greater
|
|
|
14f8ab |
+ than end index
|
|
|
14f8ab |
+ */
|
|
|
14f8ab |
+ if (count > end)
|
|
|
14f8ab |
+ break;
|
|
|
14f8ab |
+
|
|
|
14f8ab |
ret = glusterd_add_volume_to_dict(volinfo, dict, count, "volume");
|
|
|
14f8ab |
if (ret)
|
|
|
14f8ab |
goto out;
|
|
|
14f8ab |
@@ -3499,9 +3509,11 @@ glusterd_add_volumes_to_export_dict(dict_t **peer_data)
|
|
|
14f8ab |
totthread = 0;
|
|
|
14f8ab |
} else {
|
|
|
14f8ab |
totthread = volcnt / vol_per_thread_limit;
|
|
|
14f8ab |
- endindex = volcnt % vol_per_thread_limit;
|
|
|
14f8ab |
- if (endindex)
|
|
|
14f8ab |
- totthread++;
|
|
|
14f8ab |
+ if (totthread) {
|
|
|
14f8ab |
+ endindex = volcnt % vol_per_thread_limit;
|
|
|
14f8ab |
+ if (endindex)
|
|
|
14f8ab |
+ totthread++;
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
if (totthread == 0) {
|
|
|
14f8ab |
@@ -3527,10 +3539,10 @@ glusterd_add_volumes_to_export_dict(dict_t **peer_data)
|
|
|
14f8ab |
arg->this = this;
|
|
|
14f8ab |
arg->voldict = dict_arr[i];
|
|
|
14f8ab |
arg->start = start;
|
|
|
14f8ab |
- if (!endindex) {
|
|
|
14f8ab |
+ if ((i + 1) != totthread) {
|
|
|
14f8ab |
arg->end = ((i + 1) * vol_per_thread_limit);
|
|
|
14f8ab |
} else {
|
|
|
14f8ab |
- arg->end = (start + endindex);
|
|
|
14f8ab |
+ arg->end = ((i * vol_per_thread_limit) + endindex);
|
|
|
14f8ab |
}
|
|
|
14f8ab |
th_ret = gf_thread_create_detached(
|
|
|
14f8ab |
&th_id, glusterd_add_bulk_volumes_create_thread, arg,
|
|
|
14f8ab |
--
|
|
|
14f8ab |
1.8.3.1
|
|
|
14f8ab |
|