From 4f6ae853ffa9d06446407f389aaef61ac0b3b424 Mon Sep 17 00:00:00 2001 From: Mohit Agrawal Date: Wed, 19 Sep 2018 14:32:22 +0530 Subject: glusterd: Use GF_ATOMIC to update 'blockers' counter at glusterd_conf Problem: Currently in glusterd code uses sync_lock/sync_unlock to update blockers counter which could add delays to the overall transaction phase escpecially when there's a batch of volume stop operations processed by glusterd in brick multiplexing mode. Solution: Use GF_ATOMIC to update blocker counter to ensure unnecessary context switching can be avoided. Change-Id: Ie13177dfee2af66687ae7cf5c67405c152853990 Fixes: bz#1631128 Signed-off-by: Mohit Agrawal --- xlators/mgmt/glusterd/src/glusterd-op-sm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index 0944cc648bf..ce44c4679b1 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -6018,9 +6018,12 @@ glusterd_op_stage_validate(glusterd_op_t op, dict_t *dict, char **op_errstr, static void glusterd_wait_for_blockers(glusterd_conf_t *priv) { - while (priv->blockers) { + uint64_t blockers = GF_ATOMIC_GET(priv->blockers); + + while (blockers) { synclock_unlock(&priv->big_lock); sleep(1); + blockers = GF_ATOMIC_GET(priv->blockers); synclock_lock(&priv->big_lock); } } -- cgit