mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-11-20 06:56:27 -05:00
Fix fuse loop hang when a read worker exits
- 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.
This commit is contained in:
parent
6d138906ec
commit
cb930ee7a0
1 changed files with 12 additions and 4 deletions
|
|
@ -85,8 +85,12 @@ struct AsyncWorker
|
|||
void
|
||||
operator()() const
|
||||
{
|
||||
DEFER{ fuse_session_exit(_se); };
|
||||
DEFER{ sem_post(_finished); };
|
||||
// Set exited before waking the main loop, which rechecks it.
|
||||
DEFER
|
||||
{
|
||||
fuse_session_exit(_se);
|
||||
sem_post(_finished);
|
||||
};
|
||||
|
||||
ThreadPool::PToken ptok(_process_tp->ptoken());
|
||||
while(!fuse_session_exited(_se))
|
||||
|
|
@ -149,8 +153,12 @@ struct SyncWorker
|
|||
void
|
||||
operator()() const
|
||||
{
|
||||
DEFER{ fuse_session_exit(_se); };
|
||||
DEFER{ sem_post(_finished); };
|
||||
// Set exited before waking the main loop, which rechecks it.
|
||||
DEFER
|
||||
{
|
||||
fuse_session_exit(_se);
|
||||
sem_post(_finished);
|
||||
};
|
||||
|
||||
while(!fuse_session_exited(_se))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue