Re: [PATCH 2/8] fuse: flush pending fuse events before aborting the connection

Darrick J. Wong
2025-09-23T22:34:48Z

On Tue, Sep 23, 2025 at 01:59:36PM -0700, Darrick J. Wong wrote:
> On Tue, Sep 23, 2025 at 08:56:47PM +0200, Miklos Szeredi wrote:
> > On Tue, 23 Sept 2025 at 16:54, Darrick J. Wong <djwong@kernel.org> wrote:
> >
> > > I'm not sure what you're referring to by "special" -- are you asking
> > > about why I added the touch_softlockup_watchdog() call here but not in
> > > fuse_wait_aborted()? I think it could use that treatment too, but once
> > > you abort all the pending requests they tend to go away very quickly.
> > > It might be the case that nobody's gotten a warning simply because the
> > > aborted requests all go away in under 30 seconds.
> >
> > Maybe I'm not understanding how the softlockup detector works. I
> > thought that it triggers if task is spinning in a tight loop. That
> > precludes any timeouts, since that means that the task went to sleep.
> >
> > So what's happening here?
>
> Hrm, I thought the softlockup detector also complains about tasks stuck
> in uninterruptible sleep, but you're right, it *does* schedule() so the
> softlockup detector won't complain about it.
>
> I think. Let me go try to prove that empirically. :)

Hrm. If I change the bottom of the function to:

wait_event(fc->blocked_waitq, <some false expression>);

Then I get softlockup warnings because the process state gets set to
UNINTERRUPTIBLE, schedule() is called to pick another process, and the
umount process never reaches runnable state ever again.

If instead I change it to:

while (wait_event_timeout(fc->blocked_waitq, <false expr>, HZ) == 0) {
/* empty */
}

then I do not get softlockup warnings, because the umount process
actually does get scheduled off and on the system, repeatedly.

Conclusion: The loop is necessary to avoid softlockup warnings while the
fuse requests are processed by the server, but it is not necessary to
touch the watchdog in the loop body.

Thanks for challenging me, now I've learned something useful. :)

--D