- process-thread-queue-depth is multiplied by the process thread
count. A large depth overflowed the int, e.g.
process-thread-queue-depth=1073741824 with 2 process threads, which
is undefined behaviour.
- Cap the product at INT_MAX. The queue only counts free slots, so a
depth that large is unbounded in practice, as asked for.
- Limit read-thread-count, process-thread-count and the cor/cosr pool
size in func.readdir to 64 threads per pool. Apply the cap after
resolving automatic and CPU-divided counts; keep disabled process
pools disabled and preserve the configured strings.
- Log a syslog warning identifying the setting and limit when clamped.
For readdir, warn only when applying a valid concurrent policy,
not during validation.
- Document the fixed cap and warning behavior. Queue depths retain
their separate limits and use the clamped thread count.
- Resolve negative FUSE counts without overflowing on INT_MIN.
- At shutdown the main loop cancels read threads that are still in
receive_buf. The buffer each one had allocated for the next request
was a raw pointer, so the cancel unwind left it allocated.
LeakSanitizer reported it in about one daemon in six when unmounting
under load.
- Hold it in a unique_ptr so the unwind frees it. The async worker
releases it when handing the request to the process pool, as before.
- DEFERs run in reverse order, so workers posted the semaphore before
setting exited; the main loop could wake, see exited == 0 and wait
again. With one read thread mergerfs then stayed running after
unmount until signaled.
- Set exited and post in a single DEFER, in that order.
- Store cloned read-worker fds on fuse_session and close them there.
- Set up clone fallback through session helpers used by the loop.
- Carry per-request fds through receive, process, and reply paths.
Tests show significant performance increases in highly concurrent
workloads on a high core count system. Upto 15% better on reads and
27% on writes.
- ThreadPool::destroy used to iterate _threads directly while another
thread could be adjusting the same vector. Snapshot the vector
under the mutex and iterate the local copy for pthread_cancel /
pthread_join.
- ObjPool::construct now returns NULL when the pooled allocator
returns NULL instead of invoking placement-new on a null
pointer. In destroy, compute to_node(obj) before running the
destructor - the destructor may scrub bytes the to_node helper
reads.
- In the async/sync workers in fuse_loop, msgbuf_alloc can return
NULL under memory pressure. Fail the worker cleanly with a
diagnostic rather than dereferencing. Also introduce a small
_nproc() helper that treats hardware_concurrency()==0 as 1, so
the downstream min/max arithmetic doesn't produce a zero thread
count.