Re: [PATCH v2] fuse: Forward vfs_fadvise to backing_file in passthrough mode

From: Shai Barack

Date: Thu Oct 08 2026 - 00:14:54 EST


Hi Miklos,

Gentle ping on this v2 patch when you have a chance. It has
Reviewed-by tags from Amir and T.J.

Cheers!


On Thu, Sep 24, 2026 at 5:01 AM T.J. Mercier <tjmercier@xxxxxxxxxx> wrote:
>
> On Thu, Sep 10, 2026 at 11:45 AM Shai Barack <shayba@xxxxxxxxxx> wrote:
> >
> > When an application invokes posix_fadvise(..., POSIX_FADV_DONTNEED) or
> > other fadvise advice on a FUSE passthrough file descriptor, the VFS
> > currently only executes generic_fadvise() on the upper FUSE inode
> > mapping.
> >
> > Because FUSE passthrough does not forward fadvise operations to the
> > underlying backing file, pages residing in the lower filesystem's
> > pagecache remain resident in memory.
> >
> > During media-heavy workloads (such as image thumbnail generation or
> > streaming), single-access file data accumulates in the inactive pagecache
> > of the lower filesystem. Under memory pressure, the kernel retains these
> > stale media pages and instead evicts active executable pages from
> > running processes, leading to severe direct reclaim latency spikes.
> >
> > Architecturally, Linux VFS supports filesystem-specific fadvise
> > delegation via the .fadvise hook in struct file_operations. Implement
> > fuse_file_fadvise() in fs/fuse/file.c and register it in
> > fuse_file_operations. When passthrough is active on a fuse_file,
> > fuse_file_fadvise() forwards the vfs_fadvise() call to the lower
> > backing_file under the opened credentials, allowing POSIX_FADV_DONTNEED
> > to cleanly invalidate the physical backing filesystem pagecache.
> >
> > Signed-off-by: Shai Barack <shayba@xxxxxxxxxx>
>
> Reviewed-by: T.J. Mercier <tjmercier@xxxxxxxxxx>