Skip to contentSkip to conversation

erofs-utils: lib: capture errors from {mkfs,rebuild}_handle_inode()

PATCH New Hongzhen Luo 1 participant 1 message Nov 12, 2024 Library code

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 erofs-utils: lib: capture errors from {mkfs,rebuild}_handle_inode()

Currently, the error code returned by erofs_{mkfs,rebuild}_handle_inode() in erofs_mkfs_dump_tree() may be ignored. This patch introduces err2 to capture errors from {mkfs,rebuild}_handle_inode().

---
v2: Clean up the patch and revise the commit message.
v1: https://lore.kernel.org/all/[email protected]/

---
 lib/inode.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
lib/inode.c +4 -5
index 7abde7f4a3b5..f553becb0be0 100644
@@ -1706,7 +1706,7 @@ static int erofs_mkfs_dump_tree(struct erofs_inode *root, bool rebuild,
 {
 	struct erofs_sb_info *sbi = root->sbi;
 	struct erofs_inode *dumpdir = erofs_igrab(root);
-	int err;
+	int err, err2;
 
 	erofs_mark_parent_inode(root, root);	/* rootdir mark */
 	root->next_dirwrite = NULL;
@@ -1733,7 +1733,6 @@ static int erofs_mkfs_dump_tree(struct erofs_inode *root, bool rebuild,
 	}
 
 	do {
-		int err;
 		struct erofs_inode *dir = dumpdir;
 		/* used for adding sub-directories in reverse order due to FIFO */
 		struct erofs_inode *head, **last = &head;
@@ -1770,10 +1769,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 (err || err2)
+			return err ? err : err2;
 	} while (dumpdir);
 
 	return err;
Signature · 1 line
2.43.5