Skip to content

Commit

Permalink
eio_linux: avoid triggering a TSan warning
Browse files Browse the repository at this point in the history
TSan warns that setting `statx_works` races with users of it. This isn't
really a problem, because we always set it to the same value, but it's
distracting when looking for other bugs.

Reported by Anil Madhavapeddy in #751.
  • Loading branch information
talex5 committed Sep 6, 2024
1 parent e2dc1d7 commit 9ca440a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib_eio_linux/sched.ml
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,10 @@ let with_sched ?(fallback=no_fallback) config fn =
Uring.exit uring;
fallback (`Msg "Linux >= 5.15 is required for io_uring support")
) else (
statx_works := Uring.op_supported probe Uring.Op.msg_ring;
(* The reason for an if here is to make sure we only set it once, when
the first domain is starting. This is just to avoid a tsan warning. *)
if not !statx_works && Uring.op_supported probe Uring.Op.msg_ring then
statx_works := true;
match
let mem =
let fixed_buf_len = block_size * n_blocks in
Expand Down

0 comments on commit 9ca440a

Please sign in to comment.