From 2bb0e89e4bb113a93c6e786446a140cd99261af8 Mon Sep 17 00:00:00 2001 From: Sanju Rakonde Date: Wed, 28 Nov 2018 16:13:58 +0530 Subject: glusterd: perform rcu_read_lock/unlock() under cleanup_lock mutex Problem: glusterd should not try to acquire locks on any resources, when it already received a SIGTERM and cleanup is started. Otherwise we might hit segfault, since the thread which is going through cleanup path will be freeing up the resouces and some other thread might be trying to acquire locks on freed resources. Solution: perform rcu_read_lock/unlock() under cleanup_lock mutex. fixes: bz#1654270 Change-Id: I87a97cfe4f272f74f246d688660934638911ce54 Signed-off-by: Sanju Rakonde --- xlators/mgmt/glusterd/src/glusterd-utils.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index cdac6d5b8bf..d58121f91e9 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -10828,7 +10828,7 @@ glusterd_volume_rebalance_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict) node_uuid_str = gf_strdup(node_uuid); /* Finding the index of the node-uuid in the peer-list */ - rcu_read_lock(); + RCU_READ_LOCK; cds_list_for_each_entry_rcu(peerinfo, &conf->peers, uuid_list) { peer_uuid_str = gd_peer_uuid_str(peerinfo); @@ -10837,7 +10837,7 @@ glusterd_volume_rebalance_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict) current_index++; } - rcu_read_unlock(); + RCU_READ_UNLOCK; /* Setting the largest index value as the total count. */ ret = dict_get_int32n(ctx_dict, "count", SLEN("count"), &count); @@ -13771,7 +13771,7 @@ glusterd_count_connected_peers(int32_t *count) *count = 1; - rcu_read_lock(); + RCU_READ_LOCK; cds_list_for_each_entry_rcu(peerinfo, &conf->peers, uuid_list) { /* Find peer who is connected and is a friend */ @@ -13780,7 +13780,7 @@ glusterd_count_connected_peers(int32_t *count) (*count)++; } } - rcu_read_unlock(); + RCU_READ_UNLOCK; ret = 0; out: -- cgit