MINOR: ring: resize only under thread isolation

The ring resizing was already quite tricky, but when facing atomic
writes it will no longer be possible and we definitely do not want to
have to deal with a lock there. Since it's only done at boot time, and
possibly later from the CLI, let's just do it under thread isolation.
This commit is contained in:
Willy Tarreau 2024-02-28 09:45:54 +01:00
parent 03816ccfa9
commit 0fa05ce171

View File

@ -122,7 +122,7 @@ struct ring *ring_resize(struct ring *ring, size_t size)
if (!new)
return NULL;
HA_RWLOCK_WRLOCK(RING_LOCK, &ring->lock);
thread_isolate();
/* recheck the buffer's size, it may have changed during the malloc */
@ -135,7 +135,7 @@ struct ring *ring_resize(struct ring *ring, size_t size)
/* new is now the old one */
}
HA_RWLOCK_WRUNLOCK(RING_LOCK, &ring->lock);
thread_release();
/* free the unused one */
free(new);