[PATCH v7 05/13] erofs-utils: lib: always fix up xattr_isize even w/o xattrs

Gao Xiang hsiangkao at linux.alibaba.com
Sun Sep 10 02:32:32 AEST 2023


Don't assume xattr_isize is 0 before since it's not true for the
upcoming rebuild mode.

Signed-off-by: Gao Xiang <hsiangkao at linux.alibaba.com>
---
 lib/xattr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/xattr.c b/lib/xattr.c
index 671ae05..d755760 100644
--- a/lib/xattr.c
+++ b/lib/xattr.c
@@ -564,8 +564,10 @@ int erofs_prepare_xattr_ibody(struct erofs_inode *inode)
 	struct inode_xattr_node *node;
 	struct list_head *ixattrs = &inode->i_xattrs;
 
-	if (list_empty(ixattrs))
+	if (list_empty(ixattrs)) {
+		inode->xattr_isize = 0;
 		return 0;
+	}
 
 	/* get xattr ibody size */
 	ret = sizeof(struct erofs_xattr_ibody_header);
-- 
2.24.4



More information about the Linux-erofs mailing list