Currently, the error code returned by erofs_{mkfs,rebuild}_handle_inode()
in erofs_mkfs_dump_tree() may be ignored. This patch introduces `err1` and
`err2` to capture errors from the {mkfs,rebuild}_handle_inode() functions.Signed-off-by: Hongzhen Luo <[email protected]> --- lib/inode.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/inode.c b/lib/inode.c index 7abde7f4a3b5..e2ca07f1c18c 100644 --- a/lib/inode.c +++ b/lib/inode.c @@ -1733,7 +1733,7 @@ static int erofs_mkfs_dump_tree(struct erofs_inode *root, bool rebuild, } do { - int err; + int err1, err2; struct erofs_inode *dir = dumpdir; /* used for adding sub-directories in reverse order due to FIFO */ struct erofs_inode *head, **last = &head; @@ -1753,11 +1753,11 @@ static int erofs_mkfs_dump_tree(struct erofs_inode *root, bool rebuild, erofs_mark_parent_inode(inode, dir); if (!rebuild) - err = erofs_mkfs_handle_inode(inode); + err1 = erofs_mkfs_handle_inode(inode); else - err = erofs_rebuild_handle_inode(inode, + err1 = erofs_rebuild_handle_inode(inode, incremental); - if (err) + if (err1) break; if (S_ISDIR(inode->i_mode)) { *last = inode; @@ -1770,10 +1770,10 @@ static int erofs_mkfs_dump_tree(struct erofs_inode *root, bool rebuild, } *last = dumpdir; /* fixup the last (or the only) one */ dumpdir = head; - err = erofs_mkfs_go(sbi, EROFS_MKFS_JOB_DIR_BH, + err2 = erofs_mkfs_go(sbi, EROFS_MKFS_JOB_DIR_BH, &dir, sizeof(dir)); - if (err) - return err; + if (err1 || err2) + return err1 ? err1 : err2; } while (dumpdir); return err; -- 2.43.5
