This function maintains the write lock for a while. In practice it does
not need to hold it that long, and some parts could be performed under a
read lock. This patch first drops then re-acquires the write lock at the
function's entry. The purpose is simply to break the end-to-end atomicity
to prove that it has no impact in case something needs to be bisected
later. In fact the write lock is already dropped while calling
peer_send_updatemsg().
/* We force new pushed to 1 to force identifier in update message */
new_pushed = 1;
- if (!locked)
- HA_RWLOCK_WRLOCK(STK_TABLE_LOCK, &st->table->lock);
+ if (locked)
+ HA_RWLOCK_WRUNLOCK(STK_TABLE_LOCK, &st->table->lock);
+
+ HA_RWLOCK_WRLOCK(STK_TABLE_LOCK, &st->table->lock);
while (1) {
struct stksess *ts;
}
out:
- if (!locked)
- HA_RWLOCK_WRUNLOCK(STK_TABLE_LOCK, &st->table->lock);
+ HA_RWLOCK_WRUNLOCK(STK_TABLE_LOCK, &st->table->lock);
+
+ if (locked)
+ HA_RWLOCK_WRLOCK(STK_TABLE_LOCK, &st->table->lock);
return ret;
}