Avoid returning an error in erofs_write_device_table() if a new device slot table hasn't been allocated. Rationale is to allow erofs_importer_flush_all() to succeed when dealing with images with pre-existing device slots.
This effectively allows the following: mkfs.erofs -Enoinline_data a.erofs a/ mkfs.erofs -Enoinline_data b.erofs b/ mkfs.erofs merged.erofs a.erofs b.erofs mkfs.erofs --incremental=data merged.erofs c/ Signed-off-by: Jonathan Calmels <[email protected]> --- lib/super.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/super.c b/lib/super.c index a203f96..4a0bb3c 100644 --- a/lib/super.c +++ b/lib/super.c @@ -391,8 +391,11 @@ int erofs_write_device_table(struct erofs_sb_info *sbi) if (!sbi->extra_devices) goto out; - if (!bh) + if (!bh) { + if (erofs_sb_has_device_table(sbi)) + return 0; return -EINVAL; + } pos = erofs_btell(bh, false); if (pos == EROFS_NULL_ADDR) { -- 2.53.0
