diff options
author | Bernd Schubert <bschubert@ddn.com> | 2025-08-31 21:56:34 +0200 |
---|---|---|
committer | Bernd Schubert <bernd@bsbernd.com> | 2025-09-22 13:48:33 +0200 |
commit | 30bf3c86a933887407da901a05d726cebf6c5793 (patch) | |
tree | 7dee3b19df33a6ba4456c66035a8066cf3aca0aa | |
parent | 50d1bec4794aae9e77062de5214b91bcc52a890d (diff) | |
download | libfuse-30bf3c86a933887407da901a05d726cebf6c5793.tar.gz |
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 <bschubert@ddn.com>
-rw-r--r-- | lib/fuse_loop_mt.c | 3 |
1 files changed, 2 insertions, 1 deletions
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); |