From d57a5a57b8e87caffce94ed497240b37172f4a27 Mon Sep 17 00:00:00 2001 From: Ravishankar N Date: Wed, 2 Dec 2015 08:20:46 +0000 Subject: glusterd: add pending_node only if hxlator_count is valid Fixes a regression introduced by commit 0ef62933649392051e73fe01c028e41baddec489 . See BZ for bug description. Problem: To perform GLUSTERD_BRICK_XLATOR_OP, the rpc requires number of xlators (n) the op needs to be performed on and the xlator names are populated in dictionary with xl-0, xl-1... xl-n-1 as keys. When Volume heal full is executed, for each replica group, glustershd on the local node may or may not be selected to perform heal by glusterd. XLATOR_OP rpc should be sent to the shd running on the same node by glusterd only when glustershd on that node is selected at least once. This bug occurs when glusterd sends the rpc to local glustershd even when it is not selected for any of the replica groups. Fix: Don't send the rpc to local glustershd when it is not selected even once. Change-Id: I2c8217a8f00f6ad5d0c6a67fa56e476457803e08 BUG: 1287503 Signed-off-by: Ravishankar N Reviewed-on: http://review.gluster.org/12843 Tested-by: NetBSD Build System Tested-by: Gluster Build System Reviewed-by: Pranith Kumar Karampuri --- xlators/mgmt/glusterd/src/glusterd-op-sm.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'xlators/mgmt/glusterd/src') diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index ec635e22577..b5dae564926 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -6514,18 +6514,6 @@ glusterd_bricks_select_heal_volume (dict_t *dict, char **op_errstr, goto out; } - pending_node = GF_CALLOC (1, sizeof (*pending_node), - gf_gld_mt_pending_node_t); - if (!pending_node) { - ret = -1; - goto out; - } else { - pending_node->node = &(priv->shd_svc); - pending_node->type = GD_NODE_SHD; - cds_list_add_tail (&pending_node->list, selected); - pending_node = NULL; - } - if (!hxlator_count) goto out; if (hxlator_count == -1) { @@ -6539,7 +6527,17 @@ glusterd_bricks_select_heal_volume (dict_t *dict, char **op_errstr, ret = dict_set_int32 (dict, "count", hxlator_count); if (ret) goto out; - + pending_node = GF_CALLOC (1, sizeof (*pending_node), + gf_gld_mt_pending_node_t); + if (!pending_node) { + ret = -1; + goto out; + } else { + pending_node->node = &(priv->shd_svc); + pending_node->type = GD_NODE_SHD; + cds_list_add_tail (&pending_node->list, selected); + pending_node = NULL; + } out: gf_msg_debug (THIS->name, 0, "Returning ret %d", ret); -- cgit