diff --git a/src/sink.c b/src/sink.c index 69bb63b76..4485e95e5 100644 --- a/src/sink.c +++ b/src/sink.c @@ -298,11 +298,13 @@ int sink_announce_dropped(struct sink *sink, struct log_header hdr) * another thread is already on them and we can just pass and * count another drop (hence add 2). */ - dropped = HA_ATOMIC_FETCH_OR(&sink->ctx.dropped, 1); - if (dropped & 1) { - /* another thread was already on it */ - goto leave; - } + dropped = HA_ATOMIC_LOAD(&sink->ctx.dropped); + do { + if (dropped & 1) { + /* another thread was already on it */ + goto leave; + } + } while (!_HA_ATOMIC_CAS(&sink->ctx.dropped, &dropped, dropped | 1)); last_dropped = 0; dropped >>= 1;