Re: [PATCH] erofs: reset buf->off in erofs_init_metabuf()
From: Gao Xiang
Date: Wed Nov 11 2026 - 15:09:44 EST
On Wed, Nov 11, 2026 at 10:15:29PM +0800, Zhan Xusheng wrote:
> From: Zhan Xusheng <zhanxusheng@xxxxxxxxxx>
>
> erofs_init_metabuf() sets buf->off only for the block device and keeps
> the old value when it switches to the metabox or the managed cache.
> erofs_bread() adds buf->off to every offset, so the result depends on
> how the buffer was last initialized.
>
> getxattr and listxattr init the same buffer twice, for the inline and
> the shared xattrs, with in_metabox taken from different places. On a
> block device mount with fsoffset=, if the inode is outside the metabox
> and COMPAT_SHARED_EA_IN_METABOX is set, the shared xattrs are read at
> their metabox offset plus fsoffset. The same image mounted file-backed
> returns the right values.
>
> Reset buf->off on every init.
>
> Fixes: 414091322c63 ("erofs: implement metadata compression")
> Signed-off-by: Zhan Xusheng <zhanxusheng@xxxxxxxxxx>
Reviewed-by: Gao Xiang <xiang@xxxxxxxxxx>
Thanks,
Gao Xiang