Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1662966rwb; Mon, 7 Nov 2022 04:28:55 -0800 (PST) X-Google-Smtp-Source: AMsMyM6LrYHSwvq23jWFs0vw+YSmRcyjVF6g2bQpN1Ahe1BePIhIQ2rBiPCbq1+eWLto3MXPSIvZ X-Received: by 2002:aa7:8b46:0:b0:56c:349f:191e with SMTP id i6-20020aa78b46000000b0056c349f191emr49359583pfd.29.1667824135332; Mon, 07 Nov 2022 04:28:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667824135; cv=none; d=google.com; s=arc-20160816; b=DUdukLi9smL89ireGu/bPUdtI1TD4YDLLioNRXD2wbyeHt1cmo9XF4aLVR0XJUOAx8 tyAOT3uiL0kUTVYr+oAefyEImRJ9buOgKsNJOJnntwn5CoS9liaA0KBuXNyJ0nGCWTZ/ 174/iUoYEzh5BNcZkMPbJiCZ7mgNmWxxXiPZkVq4ZZH45t5UubiWEkF3Qjmpn1nbYMnv PB8ztdQn0PHZXibZNGBQ7AXqH68Po+hailzG4trKAmTdU5Uy1S0olP5tLgAN/nMOh3dC QSp1FGqrYZL0RoKZgnlI75VcayEm4XcvmfLfzumQ0Hop/RMQTDi/W1Fma+/w1fhgMYCA lLqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=JNdDEX4CpPBN9MdYhG0WPzSQr4IM9bJjX2aLY1pgkWQ=; b=Zl/rfVGS10csTWgcAmRN66j/87pbFFeWbUW9hTFK9glPUq9Y1nEa3cw58/3AnCye5O TeIlWTuxmwWwpycZLQfQfZmIWiOmXSO4m8a/5OLUBaRkAMupByvKjUemgLfpzXZxzW8v fq8/dL+Mn5iKmp8AfTzCFNCdPi+vYUXDol70k4OH8I2Hq88zMKZaOYahu4HL2tdzPAXc lCSdSkL1ghtV0bdCf8RNb9mZgY0fXI1SXs33tZDFhOB9OIMt6IhM6RB8/wFo8SzU8ZAn q1G+hAGDMsQtBKzrb/GCSktebaozG84pPTbrzwG+BSDI0lnr/Gj/aEQIwiHaBTE7ZCB8 CAjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="c0gv/aUw"; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q11-20020a170902f34b00b0016be68156aesi8552191ple.173.2022.11.07.04.28.41; Mon, 07 Nov 2022 04:28:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="c0gv/aUw"; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232207AbiKGM2F (ORCPT + 99 others); Mon, 7 Nov 2022 07:28:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232235AbiKGM2B (ORCPT ); Mon, 7 Nov 2022 07:28:01 -0500 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AB281B9C5 for ; Mon, 7 Nov 2022 04:27:58 -0800 (PST) Received: by mail-pg1-x535.google.com with SMTP id q71so10302147pgq.8 for ; Mon, 07 Nov 2022 04:27:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JNdDEX4CpPBN9MdYhG0WPzSQr4IM9bJjX2aLY1pgkWQ=; b=c0gv/aUwWBDsz+rpAhFK1OJM1ZyarjQ6j1OHF/XzR+8JxUx+64PbcMng9V+n31C5xv gbwpCos9lB0Uads3MgUnWl+J1QG0Py6M1Ue5QHGDFtaVYAf3+zVyr/YoNp6Xfh+ljUMk bk04gbJ9zhrGbIDaYYtu1TJqGvhXjFX0KTkhj+QUPbTqAyCVHEnvbXJJ8RewiTEWDlwg hd8NMjVGxuGPAncVGi5REoHMHaDyATKs3ObEPNi5TMmyYtkhkrNRuvQ1ZvYy6qoviyeX /ToxJbtNSz2g07SjTvkqP/mbkQpRtXXbjNYO3u1Kj0FURnVaz5OygElWTcoQNM6ARD8x /f4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JNdDEX4CpPBN9MdYhG0WPzSQr4IM9bJjX2aLY1pgkWQ=; b=4M8Fw+SDr6KR0Zh95LRiljOdtRKlqo/b7RkNv0s7rYERZUCBeLW31Ul+j27aX+fyN8 S0+ENcNNFJtQGP/tydh6lL5ycblxYkCFavIrqA15QCySzoi+nzTj/adBHBr8/eKIhuV0 3GlzxWtTVDV+HEaNDRhC0uY5Zsl5o7pxGJbEO4ai7cmvaAbjR7OGv+C+O2+opwZtvLam dn+ThO8At+hAjHzHZQH5U5dPmLafK41Q1Ak2vO/IkOMypk2QIlPFWSefS5yD+LPsNr2H fPpRIl9E3GTpV7jxM9U73oetHf9m4y9ZPGe5hKL/xndZ5GFKUd1kE1yibp9QoayCdJhp oOJg== X-Gm-Message-State: ACrzQf2Br16T4Nq1D3/DiDfVreIK/g0Qrp/8B3WOoL+QfMOaXgtkH1rQ TdJ3xfmbx+0u5fcqDC+2EYr1ZYb7L0Q= X-Received: by 2002:a63:e10:0:b0:46f:9191:7672 with SMTP id d16-20020a630e10000000b0046f91917672mr40135327pgl.552.1667824078182; Mon, 07 Nov 2022 04:27:58 -0800 (PST) Received: from localhost ([2406:7400:63:f20b:312d:45b2:85c1:c486]) by smtp.gmail.com with ESMTPSA id y13-20020aa78f2d000000b0056babe4fb8asm4348001pfr.49.2022.11.07.04.27.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Nov 2022 04:27:57 -0800 (PST) From: "Ritesh Harjani (IBM)" To: Theodore Ts'o Cc: linux-ext4@vger.kernel.org, Harshad Shirwadkar , Wang Shilong , Andreas Dilger , Li Xi , Ritesh Harjani Subject: [RFCv1 55/72] e2fsck: set E2F_FLAG_ALLOC_OK after threads Date: Mon, 7 Nov 2022 17:51:43 +0530 Message-Id: <474758c68a19b0a2fa5d5647e81d047247a93f3e.1667822611.git.ritesh.list@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Wang Shilong Only flag ALLOC OK after all threads finished without problem. Signed-off-by: Wang Shilong Signed-off-by: Ritesh Harjani (IBM) --- e2fsck/pass1.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c index 8e85f70f..a5dc6e44 100644 --- a/e2fsck/pass1.c +++ b/e2fsck/pass1.c @@ -1385,9 +1385,12 @@ static void e2fsck_pass1_post(e2fsck_t ctx) { struct problem_context pctx; ext2_filsys fs = ctx->fs; + char *block_buf; - char *block_buf = - (char *)e2fsck_allocate_memory(ctx, ctx->fs->blocksize * 3, + if (e2fsck_should_abort(ctx)) + return; + + block_buf = (char *)e2fsck_allocate_memory(ctx, ctx->fs->blocksize * 3, "block interate buffer"); reserve_block_for_root_repair(ctx); reserve_block_for_lnf_repair(ctx); @@ -1465,6 +1468,8 @@ static void e2fsck_pass1_post(e2fsck_t ctx) ext2fs_free_mem(&block_buf); ctx->flags &= ~E2F_FLAG_DUP_BLOCK; } + + ctx->flags |= E2F_FLAG_ALLOC_OK; } @@ -2355,6 +2360,7 @@ void e2fsck_pass1_run(e2fsck_t ctx) } ctx->flags |= E2F_FLAG_ALLOC_OK; + ext2fs_free_mem(&inodes_to_process); endit: e2fsck_use_inode_shortcuts(ctx, 0); ext2fs_free_mem(&inodes_to_process); -- 2.37.3