From 30bf3c86a933887407da901a05d726cebf6c5793 Mon Sep 17 00:00:00 2001 From: Bernd Schubert Date: Sun, 31 Aug 2025 21:56:34 +0200 Subject: fuse_loop_mt: Don't create new workers before init is received This is to prevent startup races. For example it is hard for threads to know the buffer size the kernel usage. In the past kernel buffer size always was max 1MB, but in the mean time this might be more, depending on system tunings. I thought I had fixed all races, but the report in issue #1296 proves otherwise. Closes: https://github.com/libfuse/libfuse/issues/1296 Signed-off-by: Bernd Schubert --- lib/fuse_loop_mt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/fuse_loop_mt.c b/lib/fuse_loop_mt.c index 77712b6..ec4bb0b 100644 --- a/lib/fuse_loop_mt.c +++ b/lib/fuse_loop_mt.c @@ -171,7 +171,8 @@ static void *fuse_do_work(void *data) if (!isforget) mt->numavail--; - if (mt->numavail == 0 && mt->numworker < mt->max_threads) + if (mt->numavail == 0 && mt->numworker < mt->max_threads && + likely(se->got_init)) fuse_loop_start_thread(mt); pthread_mutex_unlock(&se->mt_lock); -- cgit v1.2.3