Skip to content

Commit 9ca440a

Browse files
committed
eio_linux: avoid triggering a TSan warning
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.
1 parent e2dc1d7 commit 9ca440a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib_eio_linux/sched.ml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,10 @@ let with_sched ?(fallback=no_fallback) config fn =
521521
Uring.exit uring;
522522
fallback (`Msg "Linux >= 5.15 is required for io_uring support")
523523
) else (
524-
statx_works := Uring.op_supported probe Uring.Op.msg_ring;
524+
(* The reason for an if here is to make sure we only set it once, when
525+
the first domain is starting. This is just to avoid a tsan warning. *)
526+
if not !statx_works && Uring.op_supported probe Uring.Op.msg_ring then
527+
statx_works := true;
525528
match
526529
let mem =
527530
let fixed_buf_len = block_size * n_blocks in

0 commit comments

Comments
 (0)