On Tue, 6 Jun 2023 at 22:18, Bernd Schubert <bernd.schubert@xxxxxxxxxxx> wrote: > > > > On 6/6/23 16:37, Miklos Szeredi wrote: > > On Sun, 14 May 2023 at 00:04, Askar Safin <safinaskar@xxxxxxxxx> wrote: > >> > >> Will this patch fix a long-standing fuse vs suspend bug? ( > >> https://bugzilla.kernel.org/show_bug.cgi?id=34932 ) > > > > No. > > > > The solution to the fuse issue is to freeze processes that initiate > > fuse requests *before* freezing processes that serve fuse requests. > > > > The problem is finding out which is which. This can be complicated by > > the fact that a process could be both serving requests *and* > > initiating them (even without knowing). > > > > The best idea so far is to let fuse servers set a process flag > > (PF_FREEZE_LATE) that is inherited across fork/clone. For example the > > sshfs server would do the following before starting request processing > > or starting ssh: > > > > echo 1 > /proc/self/freeze_late > > > > This would make the sshfs and ssh processes be frozen after processes > > that call into the sshfs mount. > > Hmm, why would this need to be done manually on the server (daemon) > side? It could be automated on the fuse kernel side, for example in > process_init_reply() using current task context? Setting the flag for the current task wouldn't be sufficient, it would need to set it for all threads of a process. Even that wouldn't work for e.g. sshfs, which forks off ssh before starting request processing. So I'd prefer setting this explicitly. This could be done from libfuse, before starting threads. Or, as in the case of sshfs, it could be done by the filesystem itself. > > A slightly better version would give scores, the later the daemon/server > is created the higher its freezing score - would help a bit with stacked > fuse file systems, although not perfectly. For that struct task would > need to be extended, though. If we can quiesce the top of the stack, then hopefully all the lower ones will also have no activity. There could be special cases, but that would need to be dealt with in the fuse server itself. Thanks, Miklos