mirror of
https://github.com/haproxy/haproxy.git
synced 2026-04-22 14:49:45 -04:00
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:
parent
bd4fff9a76
commit
346d6c3ac7
1 changed files with 3 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in a new issue