summaryrefslogtreecommitdiffstats
path: root/xlators/cluster
diff options
context:
space:
mode:
authorJeff Darcy <jdarcy@redhat.com>2014-03-11 18:55:47 +0000
committerJeff Darcy <jdarcy@redhat.com>2014-03-11 18:59:28 +0000
commit2a2a2ab2cb08a38f0bfb773900b5ef5babce856b (patch)
treefba5d32e6d08fd7fdd4811e8778c791121f95858 /xlators/cluster
parent6eaa28f976dce3d5dc9d7fbe08a14579bb021ef4 (diff)
Fix test failures in leader election.
Change-Id: Ib5aa97dd31872f67727f3726fa96d4a663b9f6d3 Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'xlators/cluster')
-rw-r--r--xlators/cluster/nsr-server/src/leader.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/xlators/cluster/nsr-server/src/leader.c b/xlators/cluster/nsr-server/src/leader.c
index 73b9f66d5..944c85cdc 100644
--- a/xlators/cluster/nsr-server/src/leader.c
+++ b/xlators/cluster/nsr-server/src/leader.c
@@ -110,13 +110,17 @@ nsr_leader_thread (void *arg)
/* We're there. Notify other parts of the code. */
nsr_set_leader(this,priv->etcd);
/* Try to retain leadership. */
+ index_in = index_out;
+ index_out = NULL;
for (;;) {
- index_in = index_out;
- index_out = NULL;
res = etcd_lock (priv->etcd, NSR_KEY, NSR_TTL,
index_in, &index_out);
- if (index_in && (index_in != index_out)) {
- free(index_in);
+ if (index_out && (index_in != index_out)) {
+ if (index_in) {
+ free(index_in);
+ }
+ index_in = index_out;
+ index_out = NULL;
}
if (res != ETCD_OK) {
gf_log (this->name, GF_LOG_WARNING,