From 2c573a35f3d6b67723114af9e6dffad1e94474bc Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 16 Sep 2025 10:08:57 -0600 Subject: [PATCH] stat: used shared sem for stats lock Like commit: 21628ec537c7 ("fio_sem, diskutil: introduce fio_shared_sem and use it for diskutil lock") the stats sem is also potentially shared between processes, and hence should be allocated and freed as a shared sem. See the referenced commit, which has more details. Switch the stats sem to be allocated in such a way that it's propagated properly between processes. Signed-off-by: Jens Axboe --- stat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stat.c b/stat.c index ee5bdf1f..1151a09f 100644 --- a/stat.c +++ b/stat.c @@ -3688,7 +3688,7 @@ int calc_log_samples(void) void stat_init(void) { - stat_sem = fio_sem_init(FIO_SEM_UNLOCKED); + stat_sem = fio_shared_sem_init(FIO_SEM_UNLOCKED); } void stat_exit(void) @@ -3698,7 +3698,7 @@ void stat_exit(void) * have ended. */ fio_sem_down(stat_sem); - fio_sem_remove(stat_sem); + fio_shared_sem_remove(stat_sem); } /* -- 2.25.1