peer->flags |= PEER_F_LEARN_NOTUP2DATE;
for (ps = peers->remote; ps; ps = ps->next) {
if (ps->srv->shard && ps != peer) {
+ HA_SPIN_LOCK(PEER_LOCK, &ps->lock);
if (ps->srv->shard == peer->srv->shard) {
/* flag all peers from same shard
* notup2date to disable request
*/
commit_a_finish = 0;
}
+ HA_SPIN_UNLOCK(PEER_LOCK, &ps->lock);
}
}
struct peer *ps;
struct shared_table *st;
- /* Acquire lock for all peers of the section */
- for (ps = peers->remote; ps; ps = ps->next)
- HA_SPIN_LOCK(PEER_LOCK, &ps->lock);
-
/* resync timeout set to TICK_ETERNITY means we just start
* a new process and timer was not initialized.
* We must arm this timer to switch to a request to a remote
/* For each session */
for (ps = peers->remote; ps; ps = ps->next) {
+ HA_SPIN_LOCK(PEER_LOCK, &ps->lock);
+
__process_peer_learn_status(peers, ps);
__process_peer_state(peers, ps);
/* else do nothing */
} /* SUCCESSCODE */
} /* !ps->peer->local */
+
+ HA_SPIN_UNLOCK(PEER_LOCK, &ps->lock);
} /* for */
/* Resync from remotes expired: consider resync is finished */
if (!tick_is_expired(peers->resync_timeout, now_ms))
task->expire = tick_first(task->expire, peers->resync_timeout);
}
-
- /* Release lock for all peers of the section */
- for (ps = peers->remote; ps; ps = ps->next)
- HA_SPIN_UNLOCK(PEER_LOCK, &ps->lock);
}
static void __process_stopping_peer_sync(struct task *task, struct peers *peers, unsigned int state)
struct peer *ps;
struct shared_table *st;
- /* Acquire lock for all peers of the section */
- for (ps = peers->remote; ps; ps = ps->next)
- HA_SPIN_LOCK(PEER_LOCK, &ps->lock);
/* For each peer */
for (ps = peers->remote; ps; ps = ps->next) {
+ HA_SPIN_LOCK(PEER_LOCK, &ps->lock);
+
__process_peer_learn_status(peers, ps);
__process_peer_state(peers, ps);
peer_session_forceshutdown(ps);
}
}
+
+ HA_SPIN_UNLOCK(PEER_LOCK, &ps->lock);
}
/* We've just received the signal */
}
ps = peers->local;
+ HA_SPIN_LOCK(PEER_LOCK, &ps->lock);
if (ps->flags & PEER_F_TEACH_COMPLETE) {
if (peers->flags & PEERS_F_DONOTSTOP) {
/* resync of new process was complete, current process can die now */
}
}
}
-
- /* Release lock for all peers of the section */
- for (ps = peers->remote; ps; ps = ps->next)
- HA_SPIN_UNLOCK(PEER_LOCK, &ps->lock);
-
+ HA_SPIN_UNLOCK(PEER_LOCK, &ps->lock);
}
/*