[Devel] [PATCH VZ10] fs/fuse: fix iocachectr leak on failure in vStorage open

Alexey Kuznetsov kuznet at virtuozzo.com
Thu Jul 2 15:23:34 MSK 2026


Acknowledged

On Thu, Jul 2, 2026 at 1:11 PM Liu Kui <kui.liu at virtuozzo.com> wrote:
>
> The vStorage open in close_wait branch runs after fuse_file_io_open() has
> taken the inode io-mode reference. However when fuse_finish_open() returns
> error, its caller tears the file down via fuse_sync_release(), which doesn't
> call fuse_file_io_release() (ra->inode is NULL), leaking iocachectr and
> triggering WARN_ON(fi->iocachectr != 0) in fuse_evict_inode().
>
> Fix the leak by calling fuse_file_io_release() on the failure path.
>
> https://virtuozzo.atlassian.net/browse/VSTOR-136977
>
> Signed-off-by: Liu Kui <kui.liu at virtuozzo.com>
> ---
>  fs/fuse/file.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/fs/fuse/file.c b/fs/fuse/file.c
> index 2855986c987d..f77c784b938f 100644
> --- a/fs/fuse/file.c
> +++ b/fs/fuse/file.c
> @@ -353,6 +353,15 @@ int fuse_finish_open(struct inode *inode, struct file *file)
>
>                 if (!err)
>                         err = fuse_open_close_wait(inode, file);
> +
> +               /*
> +                * fuse_file_io_open() has already taken the inode io-mode reference
> +                * (fi->iocachectr). On failure the caller tears the file down via
> +                * fuse_sync_release(), which does not call fuse_file_io_release()
> +                * because ra->inode is NULL for synchronous release.
> +                */
> +               if (err)
> +                       fuse_file_io_release(ff, inode);
>         }
>
>         return err;
> --
> 2.50.1 (Apple Git-155)



More information about the Devel mailing list