Source kernel commit: 414091322c6363c9283aeb177101e4d7a3819ccd
Signed-off-by: Gao Xiang <[email protected]>
---
include/erofs/internal.h | 1 +
lib/xattr.c | 7 ++++---
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/include/erofs/internal.h b/include/erofs/internal.h
index e741f1ce62f1..671880f2db3c 100644
--- a/include/erofs/internal.h
+++ b/include/erofs/internal.h
@@ -192,6 +192,7 @@ EROFS_FEATURE_FUNCS(48bit, incompat, INCOMPAT_48BIT)
EROFS_FEATURE_FUNCS(metabox, incompat, INCOMPAT_METABOX)
EROFS_FEATURE_FUNCS(sb_chksum, compat, COMPAT_SB_CHKSUM)
EROFS_FEATURE_FUNCS(xattr_filter, compat, COMPAT_XATTR_FILTER)
+EROFS_FEATURE_FUNCS(shared_ea_in_metabox, compat, COMPAT_SHARED_EA_IN_METABOX)
EROFS_FEATURE_FUNCS(plain_xattr_pfx, compat, COMPAT_PLAIN_XATTR_PFX)
EROFS_FEATURE_FUNCS(ishare_xattrs, compat, COMPAT_ISHARE_XATTRS)
diff --git a/lib/xattr.c b/lib/xattr.c
index d8c7bff2fc87..86f2e45b09b2 100644
--- a/lib/xattr.c
+++ b/lib/xattr.c
@@ -1172,7 +1172,7 @@ static int erofs_init_inode_xattrs(struct erofs_inode *vi)
}
it.buf = __EROFS_BUF_INITIALIZER;
- erofs_init_metabuf(&it.buf, sbi, false);
+ erofs_init_metabuf(&it.buf, sbi, erofs_inode_in_metabox(vi));
it.pos = erofs_iloc(vi) + vi->inode_isize;
/* read in shared xattr array (non-atomic, see kmalloc below) */
@@ -1355,6 +1355,7 @@ static int erofs_xattr_iter_inline(struct
erofs_xattr_iter *it,
return -ENODATA;
}
+ erofs_init_metabuf(&it->buf, it->sbi, erofs_inode_in_metabox(vi));
remaining = vi->xattr_isize - xattr_header_sz;
it->pos = erofs_iloc(vi) + vi->inode_isize + xattr_header_sz;
while (remaining) {
@@ -1390,6 +1391,8 @@ static int erofs_xattr_iter_shared(struct
erofs_xattr_iter *it,
unsigned int i;
int ret = -ENODATA;
+ erofs_init_metabuf(&it->buf, sbi,
+ erofs_sb_has_shared_ea_in_metabox(sbi));
for (i = 0; i < vi->xattr_shared_count; ++i) {
it->pos = erofs_pos(sbi, sbi->xattr_blkaddr) +
vi->xattr_shared_xattrs[i] * sizeof(__le32);
@@ -1431,7 +1434,6 @@ int erofs_getxattr(struct erofs_inode *vi, const char
*name, char *buffer,
it.sbi = vi->sbi;
it.buf = __EROFS_BUF_INITIALIZER;
- erofs_init_metabuf(&it.buf, it.sbi, false);
it.buffer = buffer;
it.buffer_size = buffer_size;
it.buffer_ofs = 0;
@@ -1456,7 +1458,6 @@ int erofs_listxattr(struct erofs_inode *vi, char *buffer,
size_t buffer_size)
it.sbi = vi->sbi;
it.buf = __EROFS_BUF_INITIALIZER;
- erofs_init_metabuf(&it.buf, it.sbi, false);
it.buffer = buffer;
it.buffer_size = buffer_size;
it.buffer_ofs = 0;
--
2.43.5