erofs-utils: fix -Ededupe crash without fragments enabled
authorGao Xiang <hsiangkao@linux.alibaba.com>
Thu, 2 Jan 2025 11:34:18 +0000 (19:34 +0800)
committerGao Xiang <hsiangkao@linux.alibaba.com>
Thu, 2 Jan 2025 11:52:18 +0000 (19:52 +0800)
The root cause is the same as commit d9baceba7026 ("erofs-utils:
fix -Ededupe crash without fragments enabled").

In fact, the fragment manager should be reworked in the next major
erofs-utils version to avoid those dirty hacks.

Fixes: fc880e31b7c7 ("erofs-utils: mkfs: minor cleanup & rearrangement")
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20250102113418.3246744-1-hsiangkao@linux.alibaba.com
mkfs/main.c

index af5c08c210dfe200816da078decf72db45ac6326..3f74fa2fc272febacefa9e116a0f576e25813859 100644 (file)
@@ -1439,7 +1439,8 @@ int main(int argc, char **argv)
        if (erofstar.index_mode && g_sbi.extra_devices && !erofstar.mapfile)
                g_sbi.devs[0].blocks = BLK_ROUND_UP(&g_sbi, erofstar.offset);
 
-       if (erofs_sb_has_fragments(&g_sbi)) {
+       if ((cfg.c_fragments || cfg.c_extra_ea_name_prefixes) &&
+           erofs_sb_has_fragments(&g_sbi)) {
                erofs_update_progressinfo("Handling packed data ...");
                err = erofs_flush_packed_inode(&g_sbi);
                if (err)