From: Zhan Xusheng <zhanxusheng1024@gmail.com>
To: xiang@kernel.org
Cc: chao@kernel.org, zbestahu@gmail.com, jefflexu@163.com,
dhavale@google.com, hongbohbli@tencent.com, guochunhai@vivo.com,
linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org,
zhanxusheng@xiaomi.com
Subject: [PATCH] erofs: reset buf->off in erofs_init_metabuf()
Date: Wed, 11 Nov 2026 22:15:29 +0800 [thread overview]
Message-ID: <20261111141529.719166-1-zhanxusheng1024@gmail.com> (raw)
From: Zhan Xusheng <zhanxusheng@xiaomi.com>
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@xiaomi.com>
---
Tested with a hand-edited image, as mkfs.erofs does not produce this
layout.
---
fs/erofs/data.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/erofs/data.c b/fs/erofs/data.c
index 968303afd620..da4f3e7bd443 100644
--- a/fs/erofs/data.c
+++ b/fs/erofs/data.c
@@ -60,6 +60,7 @@ int erofs_init_metabuf(struct erofs_buf *buf, struct super_block *sb,
struct erofs_sb_info *sbi = EROFS_SB(sb);
buf->mc = false;
+ buf->off = 0;
if (in_metabox) {
if (unlikely(!sbi->metabox_inode))
return -EFSCORRUPTED;
base-commit: 7c26dc33ea7bb677db294bfb4e58d4207477c9e3
--
2.43.0
reply other threads:[~2026-11-11 14:15 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261111141529.719166-1-zhanxusheng1024@gmail.com \
--to=zhanxusheng1024@gmail.com \
--cc=chao@kernel.org \
--cc=dhavale@google.com \
--cc=guochunhai@vivo.com \
--cc=hongbohbli@tencent.com \
--cc=jefflexu@163.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=xiang@kernel.org \
--cc=zbestahu@gmail.com \
--cc=zhanxusheng@xiaomi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®