MEDIUM: ring: protect the initialization of the initial reader offset
authorWilly Tarreau <w@1wt.eu>
Wed, 28 Feb 2024 16:42:56 +0000 (17:42 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 25 Mar 2024 17:34:19 +0000 (17:34 +0000)
commit31b93b40b0200fe2d288e169126249a38289f123
tree53a64290d7e3f9a56a0d543bb2a0b8f10063c976
parenta2d2dbf210b305f78816f2880d4e7dce988c343a
MEDIUM: ring: protect the initialization of the initial reader offset

Since we're going to remove the lock, there's no more way to prevent the
ring from being fed while we're attaching a client to it. We need to
freeze the buffer while looking at its head so that we can attach there
and have a trustable one. We could do it by setting the lock bit on the
tail offset but quite frankly we don't need to bother with that, attaching
a client is rare enough to permit a thread_isolate().
src/ring.c