From patchwork Tue Mar 7 06:17:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ye Bin X-Patchwork-Id: 65279 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2269491wrd; Mon, 6 Mar 2023 22:16:53 -0800 (PST) X-Google-Smtp-Source: AK7set/B8qLt33hH9xXTXuHdUFYCuT3mXKKvFs1OUpLsWIcXj2qh4resyvmoucaZdytSE0iOWAXz X-Received: by 2002:a05:6a20:4c1f:b0:cc:6d4d:57b3 with SMTP id fm31-20020a056a204c1f00b000cc6d4d57b3mr9604647pzb.12.1678169813490; Mon, 06 Mar 2023 22:16:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678169813; cv=none; d=google.com; s=arc-20160816; b=wxigdye9n158oc4mBPLnDU+daCloSxl/zarY/zy0LX3V9nl/vf4CKk+Np/zAoze8iA SHd7QdEJ6wilj2K0b2G5G70OQGJ2Q/b4E2/H7d6ZNl1SktnNf0cohmNcT5qZOmG40l8d 5aTy9hSk8S7VeT/NZQRHmuoEekWhSTWYRdzLaDYJohCc0vhT5qQx/tNovWSmGMsgSx0M tGB5m31/8rWGHxqMjpBRsCB1aV2RCYIK9C6Zby6ULP182vGxJADhx7Glvs7mGMmJQdRl qmRd3+FOh+SamUyMeYwXMxJnwO9M9A2ZtZ0fBND6q9YIBd5VFXarGqBrmsK2DXjUP1UX ePTQ== 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; bh=8i+Zj9+QGggl26vgmUjoAEwiSxsg6V+rP9k2faakMy4=; b=AJ8dnPqIfcsnkjFe3dzb1KkncIBboNGPYOR4+fUpUe1Lm0d2pJf+9Njm1uPQEjuNBF LMQhALgRySiVKKsa+L/v7m4dtcc2sSQj4zxHYGKRXjtwRoz42yY7wukZnyEKJp50R8Yd KSPl6CZSAi2e16Tike5V+YWA6LlBUHJSCxM2lLfKn0By3qwBQeML34nXPojdBrUlpufc wLVNhlH5PgWehlCKLSRdzp6+Nup45nu1jyOEKu/i6pJ+UqLvlrVyDz6aliRPFdEm2gAh hI4QlkC5p4476yT3OUjIuFtUorDOnImspYWexXbbqhsioYo9/Doc1EHrhTUoEfdJgKzC Vo6g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 136-20020a63008e000000b004fbcde9147dsi11922694pga.375.2023.03.06.22.16.39; Mon, 06 Mar 2023 22:16:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230347AbjCGFyI (ORCPT + 99 others); Tue, 7 Mar 2023 00:54:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230054AbjCGFx6 (ORCPT ); Tue, 7 Mar 2023 00:53:58 -0500 Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E64ED32CC4; Mon, 6 Mar 2023 21:53:56 -0800 (PST) Received: from mail02.huawei.com (unknown [172.30.67.169]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4PW4Pq2Xtwz4f3jJ2; Tue, 7 Mar 2023 13:53:51 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.127.227]) by APP3 (Coremail) with SMTP id _Ch0CgCnUiBv0QZk79DuEQ--.5436S6; Tue, 07 Mar 2023 13:53:53 +0800 (CST) From: Ye Bin To: tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org Cc: linux-kernel@vger.kernel.org, jack@suse.cz, Ye Bin Subject: [PATCH v5 2/2] ext4: make sure fs error flag setted before clear journal error Date: Tue, 7 Mar 2023 14:17:03 +0800 Message-Id: <20230307061703.245965-3-yebin@huaweicloud.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230307061703.245965-1-yebin@huaweicloud.com> References: <20230307061703.245965-1-yebin@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: _Ch0CgCnUiBv0QZk79DuEQ--.5436S6 X-Coremail-Antispam: 1UD129KBjvdXoWrtryDXF13GrW7XryxXryrZwb_yoWkZrcEq3 yxAan5WrsxAw1xK3WrCan8Ww1vvws2vF1rXasayFn8uryDXa4kCa4DWr93urn8urWrK398 JF17ZF1fKFykXjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbV8YFVCjjxCrM7AC8VAFwI0_Xr0_Wr1l1xkIjI8I6I8E6xAIw20E Y4v20xvaj40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l82xGYIkIc2x26280x7IE14v26r15M2 8IrcIa0xkI8VCY1x0267AKxVW8JVW5JwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK 021l84ACjcxK6xIIjxv20xvE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r 4UJVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_ GcCE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx 0E2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWU JVW8JwACjcxG0xvY0x0EwIxGrwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJV W8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF 1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6x IIjxv20xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvE x4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvj DU0xZFpf9x07jeWlkUUUUU= X-CM-SenderInfo: p1hex046kxt4xhlfz01xgou0bp/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE 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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759688590050804679?= X-GMAIL-MSGID: =?utf-8?q?1759688590050804679?= From: Ye Bin Now, jounral error number maybe cleared even though ext4_commit_super() failed. This may lead to error flag miss, then fsck will miss to check file system deeply. Signed-off-by: Ye Bin Reviewed-by: Jan Kara --- fs/ext4/super.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index dfa31eea1346..bf52b8a50717 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -6166,11 +6166,13 @@ static int ext4_clear_journal_err(struct super_block *sb, errstr = ext4_decode_error(sb, j_errno, nbuf); ext4_warning(sb, "Filesystem error recorded " "from previous mount: %s", errstr); - ext4_warning(sb, "Marking fs in need of filesystem check."); EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS; es->s_state |= cpu_to_le16(EXT4_ERROR_FS); - ext4_commit_super(sb); + j_errno = ext4_commit_super(sb); + if (j_errno) + return j_errno; + ext4_warning(sb, "Marked fs in need of filesystem check."); jbd2_journal_clear_err(journal); jbd2_journal_update_sb_errno(journal);