On Mon, 19 May 2025, songbird wrote:

Tim Woodall wrote:
Short script below that shows my problem.

fusermount -u (and umount) both return before all the data is written
out to the backing file on a fuse FS. Is there any way to tell when this
is complete? I tried running fuse in the foreground and then doing a
wait $PID but that didn't help, I still needed the sleep.

At least on my system, with a fs of 50G it always unmounts quickly
enough for the e2fsck to pass, at 500G it sometimes does, and at 5T it
seems to always fail without the sleep (which can probably be a bit
shorter than 30s but I haven't bothered to try to work out exactly how
much shorter it can safely be.

Tim.


 sync should do it, but there are important details to check
which i hope are explained by the man page or the referenced
items at the bottom:

I tried sync but it didn't work - the key problem is that when you call fusermount -u, that returns while the fuse2fs program is still writing stuff. In one case I have it takes 90s to complete writing all the changes before it exits after it's unmounted.

I tried running fuse2fs in the foreground, backgrounding it in bash, and doing a wait <pid> but that didn't work either. However, I didn't think to also include a sync.

I've added an --inuse=<file> option that is created when fuse2fs starts and is unlinked as the very last thing before it exits and I've also included a sync after the inuse file disappears and that seems to have fixed the issue (my full test hasn't finished yet - takes over 30 minutes)

Your email gave me the hint to try wait and sync. Although I don't think the sync should be necessary as we're writing to the file in userspace. Perhaps the --inuse change is more reliable than wait pid in bash (I will try without the sync to see once this test is completed)

Thanks.

Reply via email to