[Devel] [PATCH hci-8.1 3/3] fs/fuse: use wait_var_event to wait for fuse file references
no-reply at sashiko.virtuozzo.com
no-reply at sashiko.virtuozzo.com
Wed Sep 30 08:51:54 MSK 2026
> On close_wait mounts, fuse_release_close_wait() needs to wait for all
> asynchronous references to the fuse file to be dropped before sending
> FUSE_RELEASE. This wait on fi->page_waitq was inherited from the past
> implementation and is no longer appropriate as the wait condition
> evolved:
>
> - fi->page_waitq is meant to serve page-under-writeback waiters and
> fuse_set_nowrite()'s writectr waiters; now it also has to serve the
> ff reference waiter, so every wakeup can wake unrelated waiters.
>
> - the wake is decoupled from the decrement, so every path dropping an
> ff reference must remember to wake fi->page_waitq, and because of
> this we grew two variants of the stock fuse_file_put():
> __fuse_file_put() and fuse_release_ff(). This is bug prone, and a
> misuse can leave the releaser blocked forever.
>
> Instead of waiting on fi->page_waitq, a simple wait_var_event() on
> &ff->count serves the purpose best: the matching wake_up_var() uses
> the address purely as a hash key and never dereferences it, so the
> wakeup can be folded into fuse_file_put() itself. With that, both
> __fuse_file_put() and fuse_release_ff() become redundant and are
> removed. This cleanup also makes the code less divergent from
> mainline.
>
> https://virtuozzo.atlassian.net/browse/VSTOR-147878
>
> Signed-off-by: Liu Kui <kui.liu at virtuozzo.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20260930-close-wait-rework-v2-v1-0-f8062178544a@virtuozzo.com?part=3
More information about the Devel
mailing list