Revert "WIP/MEDIUM: peers: Stop to change the stksess ref_cnt when sending update messages"

This reverts commit 871794586716396755dd7d77a6597be6cee97363.
This commit is contained in:
Christopher Faulet 2025-10-15 16:16:45 +02:00
parent 95da51a6dc
commit 53d8d28fdd
2 changed files with 17 additions and 1 deletions

View File

@ -1591,8 +1591,11 @@ int peer_send_teachmsgs(struct appctx *appctx, struct peer *p, struct shared_tab
applet_have_more_data(appctx);
ret = -1;
}
else
else {
HA_ATOMIC_INC(&ts->ref_cnt);
ret = peer_send_updatemsg(st, appctx, ts, st->update_id, new_pushed, use_timed);
HA_ATOMIC_DEC(&ts->ref_cnt);
}
if (ret <= 0) {
/* Insert <last> marker before <ts> to process it again

View File

@ -141,6 +141,10 @@ int __stksess_kill(struct stktable *t, struct stksess *ts)
/* ... and that we didn't leave the update list for the tree */
if (MT_LIST_INLIST(&ts->upd)) {
link = mt_list_lock_full(&ts->upd);
if (HA_ATOMIC_LOAD(&ts->ref_cnt)) {
mt_list_unlock_full(&ts->upd, link);
goto out;
}
mt_list_unlock_link(link);
mt_list_unlock_self(&ts->upd);
}
@ -381,8 +385,13 @@ int stktable_trash_oldest(struct stktable *t)
* Peers will lock the element. So to the same here to avoid any conflict
*/
MT_LIST_DELETE(&ts->pend_updts);
if (MT_LIST_INLIST(&ts->upd)) {
link = mt_list_lock_full(&ts->upd);
if (HA_ATOMIC_LOAD(&ts->ref_cnt)) {
mt_list_unlock_full(&ts->upd, link);
goto requeue;
}
mt_list_unlock_link(link);
mt_list_unlock_self(&ts->upd);
}
@ -1038,6 +1047,10 @@ struct task *process_tables_expire(struct task *task, void *context, unsigned in
MT_LIST_DELETE(&ts->pend_updts);
if (MT_LIST_INLIST(&ts->upd)) {
link = mt_list_lock_full(&ts->upd);
if (HA_ATOMIC_LOAD(&ts->ref_cnt)) {
mt_list_unlock_full(&ts->upd, link);
goto requeue;
}
mt_list_unlock_link(link);
mt_list_unlock_self(&ts->upd);
}