summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorVijay Bellur <vbellur@redhat.com>2015-04-02 00:29:59 +0530
committerVijay Bellur <vbellur@redhat.com>2015-04-02 03:10:25 -0700
commit12e603bb9d8bc220eeea01c0ecc8ca63f9df4bc4 (patch)
treeaceecaef9e9217862e47cf955b3e93eacc2c9e15 /xlators/mgmt
parent10b4ecb85c5009c6c7b9422bd5299ba43d8448a1 (diff)
glusterd: Fix rebase errors introduced by 4b18fba
4b18fba 'glusterd: group server-quorum related code together' a refactoring change, introduced some errors related to usage of userspace-rcu lists when rebasing. This patch fixes it. Changes done include, - Redo changes done by 673ba26 glusterd: Replace libglusterfs lists with liburcu lists - Redo changes done by c7785f7 glusterd: Protect the peer list and peerinfos with RCU. - Redo changes done by 891c7d0 glusterd: Prevent possible deadlock due to glusterd_quorum_count Change-Id: I789e5bc8b209d9ed6dd951d609baa90e89817639 BUG: 1205592 Signed-off-by: Vijay Bellur <vbellur@redhat.com> Signed-off-by: Kaushal M <kaushal@redhat.com> Reviewed-on: http://review.gluster.org/10105 Reviewed-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-by: Niels de Vos <ndevos@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-server-quorum.c24
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-server-quorum.h6
2 files changed, 16 insertions, 14 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-server-quorum.c b/xlators/mgmt/glusterd/src/glusterd-server-quorum.c
index cb707a0caae..6178f273629 100644
--- a/xlators/mgmt/glusterd/src/glusterd-server-quorum.c
+++ b/xlators/mgmt/glusterd/src/glusterd-server-quorum.c
@@ -201,7 +201,7 @@ _does_quorum_meet (int active_count, int quorum_count)
int
glusterd_get_quorum_cluster_counts (xlator_t *this, int *active_count,
int *quorum_count,
- struct list_head *peer_list,
+ struct cds_list_head *peer_list,
gf_boolean_t _local_xaction_peers)
{
glusterd_peerinfo_t *peerinfo = NULL;
@@ -220,23 +220,24 @@ glusterd_get_quorum_cluster_counts (xlator_t *this, int *active_count,
if (active_count)
*active_count = 1;
+ rcu_read_lock ();
if (!peer_list) {
- list_for_each_entry (peerinfo, &conf->peers, uuid_list) {
- glusterd_quorum_count(peerinfo, inquorum_count,
- active_count, out);
+ cds_list_for_each_entry (peerinfo, &conf->peers, uuid_list) {
+ GLUSTERD_QUORUM_COUNT (peerinfo, inquorum_count,
+ active_count, out);
}
} else {
if (_local_xaction_peers) {
list_for_each_local_xaction_peers (peerinfo,
peer_list) {
- glusterd_quorum_count(peerinfo, inquorum_count,
- active_count, out);
+ GLUSTERD_QUORUM_COUNT (peerinfo, inquorum_count,
+ active_count, out);
}
} else {
- list_for_each_entry (peerinfo, peer_list,
- op_peers_list) {
- glusterd_quorum_count(peerinfo, inquorum_count,
- active_count, out);
+ cds_list_for_each_entry (peerinfo, peer_list,
+ op_peers_list) {
+ GLUSTERD_QUORUM_COUNT (peerinfo, inquorum_count,
+ active_count, out);
}
}
}
@@ -256,6 +257,7 @@ glusterd_get_quorum_cluster_counts (xlator_t *this, int *active_count,
*quorum_count = count;
ret = 0;
out:
+ rcu_read_unlock ();
return ret;
}
@@ -293,7 +295,7 @@ glusterd_is_any_volume_in_server_quorum (xlator_t *this)
}
gf_boolean_t
-does_gd_meet_server_quorum (xlator_t *this, struct list_head *peers_list,
+does_gd_meet_server_quorum (xlator_t *this, struct cds_list_head *peers_list,
gf_boolean_t _local_xaction_peers)
{
int quorum_count = 0;
diff --git a/xlators/mgmt/glusterd/src/glusterd-server-quorum.h b/xlators/mgmt/glusterd/src/glusterd-server-quorum.h
index 96aba06df24..509a60d9f31 100644
--- a/xlators/mgmt/glusterd/src/glusterd-server-quorum.h
+++ b/xlators/mgmt/glusterd/src/glusterd-server-quorum.h
@@ -15,7 +15,7 @@
#include "config.h"
#endif
-#define glusterd_quorum_count(peerinfo, inquorum_count,\
+#define GLUSTERD_QUORUM_COUNT(peerinfo, inquorum_count,\
active_count, _exit)\
do {\
if (peerinfo->quorum_contrib == QUORUM_WAITING)\
@@ -40,7 +40,7 @@ glusterd_do_quorum_action ();
int
glusterd_get_quorum_cluster_counts (xlator_t *this, int *active_count,
int *quorum_count,
- struct list_head *peer_list,
+ struct cds_list_head *peer_list,
gf_boolean_t _local__xaction_peers);
gf_boolean_t
@@ -54,6 +54,6 @@ glusterd_is_any_volume_in_server_quorum (xlator_t *this);
gf_boolean_t
does_gd_meet_server_quorum (xlator_t *this,
- struct list_head *peers_list,
+ struct cds_list_head *peers_list,
gf_boolean_t _local__xaction_peers);
#endif /* _GLUSTERD_SERVER_QUORUM_H */