[Devel] [PATCH hci-8.1 2/3] fs/fuse: move the close_wait handling of fuse_release() into a helper
no-reply at sashiko.virtuozzo.com
no-reply at sashiko.virtuozzo.com
Wed Sep 30 08:49:37 MSK 2026
> Move all the close_wait handling of fuse_release() into a new helper
> fuse_release_close_wait(), and restore the !close_wait case to the
> mainline behavior except the FMODE_WRITE check.
>
> Unify the code paths: unconditionally remove the file from
> fi->write_files and wait until we hold the last reference. Decrement
> fi->num_openers under the inode lock, which detects the last open.
> This fixes two racing releasers both reading num_openers == 0 and
> calling kio's file_close twice, possible because the decrement was
> done early under fi->lock while the check ran later under the inode
> lock:
>
> releaser A releaser B
> ---------- ----------
> --fi->num_openers (2 -> 1)
> --fi->num_openers (1 -> 0)
> inode_lock()
> num_openers == 0 -> file_close()
> inode_unlock()
> inode_lock()
> num_openers == 0 -> file_close()
>
> The atomic decrement under the inode lock also matches the increment
> in fuse_open_close_wait() for !writeback_cache files.
>
> 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=2
More information about the Devel
mailing list