BUG/MINOR: stick-tables: Fix return value for __stksess_kill()

The commit 9938fb9c7 ("BUG/MEDIUM: stick-tables: Fix race with peers when
killing a sticky session") introduced a regression.

__stksess_kill() must always return 0 if the session cannot be released. But
when the ref_cnt is tested under the update lock, a success is reported if
the session is still in-used. 0 must be returned in that case.

This bug is harmless because callers never use the return value of
__stksess_kill() or stksess_kill().

This bug must be backported as far as 3.0.
This commit is contained in:
Christopher Faulet 2025-11-14 11:48:02 +01:00
parent bd4fff9a76
commit 346d6c3ac7

View file

@ -131,6 +131,7 @@ void stksess_free(struct stktable *t, struct stksess *ts)
int __stksess_kill(struct stktable *t, struct stksess *ts)
{
int updt_locked = 0;
int removed = 0;
if (HA_ATOMIC_LOAD(&ts->ref_cnt))
return 0;
@ -153,11 +154,12 @@ int __stksess_kill(struct stktable *t, struct stksess *ts)
eb32_delete(&ts->upd);
ebmb_delete(&ts->key);
__stksess_free(t, ts);
removed = 1;
out_unlock:
if (updt_locked)
HA_RWLOCK_WRUNLOCK(STK_TABLE_UPDT_LOCK, &t->updt_lock);
return 1;
return removed;
}
/*