erofs-utils: mkfs: fix a regression where rebuild mode does not work
authorGao Xiang <hsiangkao@linux.alibaba.com>
Thu, 19 Sep 2024 02:16:35 +0000 (10:16 +0800)
committerGao Xiang <hsiangkao@linux.alibaba.com>
Thu, 19 Sep 2024 02:37:39 +0000 (10:37 +0800)
It will fail unexpectedly if any sub-image lacks an extra device (blob).

Fixes: 7550a30c332c ("erofs-utils: enable incremental builds")
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20240919021635.2922387-1-hsiangkao@linux.alibaba.com
mkfs/main.c

index 5c8b5e4f394e9651578f027d81090fddd0c8a803..7e2e184bc6a220e516f448b09949fd482a45e7de 100644 (file)
@@ -1091,7 +1091,8 @@ static int erofs_mkfs_rebuild_load_trees(struct erofs_inode *root)
        if (datamode != EROFS_REBUILD_DATA_BLOB_INDEX)
                return 0;
 
-       if (extra_devices != rebuild_src_count) {
+       /* Each blob has either no extra device or only one device for TarFS */
+       if (extra_devices && extra_devices != rebuild_src_count) {
                erofs_err("extra_devices(%u) is mismatched with source images(%u)",
                          extra_devices, rebuild_src_count);
                return -EOPNOTSUPP;