Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 36CFFD41D44 for ; Tue, 12 Nov 2024 02:08:53 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4XnVFw0npzz2ygy for ; Tue, 12 Nov 2024 13:08:52 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip=115.124.30.112 ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1731377329; cv=none; b=TJ1h75osbElC0mVcqXUAwyl0SHVEEMZ2KMZ08tAZOuhHuovUgp1+KCHizVMdMcYK5Lz0Mj3GchGmFnw78siqTWpCLzrSgr07EROQ3lgyyFM9uFHStDHc5WTnv5AJApER/xFtOGsHfm+Z4IcTlo/5zOV7bLauYQWslTCQsD5cD0nnF7hFcxkH7e7HE7T2s/+PEz5E3n7SCFoI/3YuTZtzV05ObA/aK1lN7IOmrpfL4XBweb1xzjjlSreroJqqlHb+QgFdjJ+TgFyZCNjPt8oxmYkL0Pr3XzSChf+LT+e3XdLPP07FxGFHkBH5F8gdyE/GIIjD2L8xmiinHSlHNZp0jw== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1731377329; c=relaxed/relaxed; bh=YAXAHtQpywINQQ9j646N68G7lbT4FT/X77uT0S3LtAU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=UajgP9NkB0YhSG3WsrWTlfLpYo36CIO9J0Kepa7dN3yv7KEJ32ut3BzVR0zsOWhlHZjXQl9PNir8O6pa9Ym20SQyvaPZ3EQUnYq4v3gLf8RrGAOsXM4227whBVuQxsFhcyn55zIhR2FGPWrdjK3h1FneGZ2OEw5Sd+xQSEsGNbfvNvQBHdUBrlOYFsb0n5F0jXjZRxw2273PAhpN2zx5DNnvkzcYInae7cAnU5oODiCJzOV9iVp/7vF4VUx8KubZa+FOnCHxAI3bUBfHFpueLHzT2C0T6x85rqtG/ifZgblv2mGz0VUMRwlmdpGEV6B3bxlPlmJP9y75UmeaNFI/WA== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; dkim=pass (1024-bit key; unprotected) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=RrTqU7LL; dkim-atps=neutral; spf=pass (client-ip=115.124.30.112; helo=out30-112.freemail.mail.aliyun.com; envelope-from=hongzhen@linux.alibaba.com; receiver=lists.ozlabs.org) smtp.mailfrom=linux.alibaba.com Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=RrTqU7LL; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.alibaba.com (client-ip=115.124.30.112; helo=out30-112.freemail.mail.aliyun.com; envelope-from=hongzhen@linux.alibaba.com; receiver=lists.ozlabs.org) Received: from out30-112.freemail.mail.aliyun.com (out30-112.freemail.mail.aliyun.com [115.124.30.112]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4XnVFp5ySjz2xnc for ; Tue, 12 Nov 2024 13:08:38 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1731377313; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=YAXAHtQpywINQQ9j646N68G7lbT4FT/X77uT0S3LtAU=; b=RrTqU7LLCuA2IOsgMHTKwnG0PzPwxG113+H6gxIQjR2NC+4SjmXnf+6KyYleHuIAU6Jv+w2wBGhweC47qBcxdF+TwZtASKY37mVK7xJM4T1fI6AfdbW+U7apd9O7E+rABKna53TJ5082Yp7xXk2f+91Hwt0EH1IfeRdNAdEqx8Y= Received: from localhost(mailfrom:hongzhen@linux.alibaba.com fp:SMTPD_---0WJF8grv_1731377311 cluster:ay36) by smtp.aliyun-inc.com; Tue, 12 Nov 2024 10:08:32 +0800 From: Hongzhen Luo To: linux-erofs@lists.ozlabs.org Subject: [PATCH v2] erofs-utils: lib: capture errors from {mkfs,rebuild}_handle_inode() Date: Tue, 12 Nov 2024 10:08:30 +0800 Message-ID: <20241112020830.849210-1-hongzhen@linux.alibaba.com> X-Mailer: git-send-email 2.43.5 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: linux-erofs@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development of Linux EROFS file system List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-erofs-bounces+linux-erofs=archiver.kernel.org@lists.ozlabs.org Sender: "Linux-erofs" 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(). Signed-off-by: Hongzhen Luo --- v2: Clean up the patch and revise the commit message. v1: https://lore.kernel.org/all/20241111110926.3909753-1-hongzhen@linux.alibaba.com/ --- lib/inode.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/inode.c b/lib/inode.c index 7abde7f4a3b5..f553becb0be0 100644 --- a/lib/inode.c +++ b/lib/inode.c @@ -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; -- 2.43.5