erofs-utils: lib: always fix up xattr_isize even w/o xattrs
authorGao Xiang <hsiangkao@linux.alibaba.com>
Sat, 9 Sep 2023 16:32:32 +0000 (00:32 +0800)
committerGao Xiang <hsiangkao@linux.alibaba.com>
Mon, 11 Sep 2023 03:22:05 +0000 (11:22 +0800)
Don't assume xattr_isize is 0 before since it's not true for the
upcoming rebuild mode.

Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20230909163240.42057-6-hsiangkao@linux.alibaba.com
lib/xattr.c

index 671ae05164c37169733f1d0e8d548d48934546f1..d7557608417e965a7b66842e1264b4e47d5964ed 100644 (file)
@@ -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);