Re: [PATCH] erofs: use the shared page cache for splice in inode_share mode

From: Gao Xiang

Date: Thu Aug 20 2026 - 09:29:39 EST


Hi Xusheng,

On Thu, Aug 20, 2026 at 02:44:41PM +0800, Zhan Xusheng wrote:
> From: Zhan Xusheng <zhanxusheng1024@xxxxxxxxx>
>
> From: Zhan Xusheng <zhanxusheng@xxxxxxxxxx>
>

the subject can be improved as "erofs: support splice() in inode_share mode"

> erofs_ishare_fops routes everything that touches the page cache to the
> backing file in ->private_data: read_iter clones the iocb onto it, mmap
> does vma_set_file(), fadvise calls vfs_fadvise() on it. splice_read was
> left as filemap_splice_read(), which works on the user file's own mapping.
>
> filemap_splice_read() does init_sync_kiocb(&iocb, in), and
> filemap_get_pages() then takes iocb->ki_filp->f_mapping, so splice() and
> sendfile() populate the per-file page cache from disk instead of using the
> shared one. The data is correct, since erofs_fill_inode() sets that
> mapping's a_ops either way, but the same content ends up cached twice,
> which is what inode_share is there to avoid.
>
> Pass the backing file, as read_iter already does.
>
> Fixes: 5ef3208e3be5 ("erofs: introduce the page cache share feature")
> Link: https://lore.kernel.org/all/b7dc7192-d586-45a2-bc4a-b41dc681c9bb@xxxxxxxxxxxxxxxxx/
> Signed-off-by: Zhan Xusheng <zhanxusheng@xxxxxxxxxx>

I observed the sashiko's report too:
https://sashiko.dev/#/patchset/20260818113713.116849-1-jefflexu%40linux.alibaba.com

Regardless of the implementation details, I don't think it is a fix
since this feature should be considered as a best-effort approach.

If it's an enhancement, please also write an erofs-utils test and
drop the fixes tag.

Thanks,
Gao Xiang