Message ID | 20230301115909.184772-3-yebin@huaweicloud.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp3582427wrd; Wed, 1 Mar 2023 03:46:24 -0800 (PST) X-Google-Smtp-Source: AK7set8FAYReGkRE2pvfbBCj2ob8fD5Uk5YAmHThRXeX2PrSDkP2eKqmVpRsG1T9jiavwvHgbS65 X-Received: by 2002:aa7:da83:0:b0:4bd:8714:cc54 with SMTP id q3-20020aa7da83000000b004bd8714cc54mr742403eds.36.1677671183846; Wed, 01 Mar 2023 03:46:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677671183; cv=none; d=google.com; s=arc-20160816; b=Y52y+gS+6R5+4o0CvJNAVEDBcZrYzM66loctwgpeqbGCqd43VUdljd3rB3GRtjcB0p 6Rhr5KhsRofyzzGnYBU/FjOyCR54USIZlY7bAR+kMlyVlsfhRegJG9LvvBbnWUThywnt zWKc/FI+M+w7+agcAQK7neth8CIJFLtx9vcji0v6PP7m4G+ZkMCrUEAmXTYOgguCEqs8 axYS9pC0Tz5NyKGlgr1FURJuiMR/CceK3sjvbyQmjeO8MqaAlnDWgrS+RcqFk02hqQUf wQ0WCWG5wtk0ergT0xZFkq6ZP6MNqPDAZNBNVGENrSYeK/iNhDQsLSQxmE7QlU/Ob2At DOcQ== 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=QEBhs12Qu+TS7lbGTIsgSy5T/ui+aRhpzlu2Q63veKw=; b=sLAiJOuiKfU7qI6arbn1dK3/Rz2I/vcRAvh+BzLoyYnsZfbLqSgO1oWkJlfHJS0DKG 9nu2Ecv0aQFJfQy0bEJBjS4UbJUnZVVtU6F9Xub1cT6vEAPVMwkLltZ4zwTiaqC6RcvQ LKwJQJOPKm6xWSsABxSMYfFkrh5TYY053hiMcGTjCVH4+7yQImB1tg9jKegHbBTa4q/g IS3l4kNb9xWLYnKeNbtYl0EbWZ4Gk+/hU8rtPKNN+KF0nS4qyu5PLTRq4+EnEc1eyRUV YEE3G6AmMabgPRsI0aEfTLoFWeIQ9lwpCp38HRdJ8/EIIagAeRosB66IOlsQVyOocvXc QGyA== 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 v18-20020a17090690d200b008e656382899si13546317ejw.678.2023.03.01.03.46.01; Wed, 01 Mar 2023 03:46:23 -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 S230082AbjCALgE (ORCPT <rfc822;david.simonyants@gmail.com> + 99 others); Wed, 1 Mar 2023 06:36:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229529AbjCALf4 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 1 Mar 2023 06:35:56 -0500 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7E322FCE5; Wed, 1 Mar 2023 03:35:54 -0800 (PST) Received: from mail02.huawei.com (unknown [172.30.67.169]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4PRXHB0sl3z4f3jYp; Wed, 1 Mar 2023 19:35:50 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.127.227]) by APP3 (Coremail) with SMTP id _Ch0CgDHcyGVOP9jOXabEA--.39702S6; Wed, 01 Mar 2023 19:35:52 +0800 (CST) From: Ye Bin <yebin@huaweicloud.com> To: tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org Cc: linux-kernel@vger.kernel.org, jack@suse.cz, Ye Bin <yebin10@huawei.com> Subject: [PATCH v4 2/2] ext4: make sure fs error flag setted before clear journal error Date: Wed, 1 Mar 2023 19:59:09 +0800 Message-Id: <20230301115909.184772-3-yebin@huaweicloud.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230301115909.184772-1-yebin@huaweicloud.com> References: <20230301115909.184772-1-yebin@huaweicloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: _Ch0CgDHcyGVOP9jOXabEA--.39702S6 X-Coremail-Antispam: 1UD129KBjvdXoWrtryDXF13GrW7XryxXryrZwb_yoWkZrcEq3 yIyan5WrsxAw1xK3WrCan8WwnYvws2vr15X3ZayF15uryDXas5Ca4DWr93urn8urWrKrZ8 tF17ZF1fG3ykXjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbsAYFVCjjxCrM7AC8VAFwI0_Xr0_Wr1l1xkIjI8I6I8E6xAIw20E Y4v20xvaj40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l82xGYIkIc2x26280x7IE14v26r15M2 8IrcIa0xkI8VCY1x0267AKxVW8JVW5JwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK 021l84ACjcxK6xIIjxv20xvE14v26ryj6F1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26F 4j6r4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0 oVCq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7V C0I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j 6r4UM4x0Y48IcxkI7VAKI48JMxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r 4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF 67AKxVWUAVWUtwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2I x0cI8IcVCY1x0267AKxVW8JVWxJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2 z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnU UI43ZEXa7IU86wZ7UUUUU== 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759165739227709191?= X-GMAIL-MSGID: =?utf-8?q?1759165739227709191?= |
Series |
fix error flag covered by journal recovery
|
|
Commit Message
Ye Bin
March 1, 2023, 11:59 a.m. UTC
From: Ye Bin <yebin10@huawei.com> 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 <yebin10@huawei.com> Reviewed-by: Jan Kara <jack@suse.cz> --- fs/ext4/super.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Comments
On 2023/3/1 19:59, Ye Bin wrote: > From: Ye Bin <yebin10@huawei.com> > > 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 <yebin10@huawei.com> > Reviewed-by: Jan Kara <jack@suse.cz> Looks good to me. Reviewed-by: Baokun Li <libaokun1@huawei.com> > --- > 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 9df8fada2dce..7736c96d5a78 100644 > --- a/fs/ext4/super.c > +++ b/fs/ext4/super.c > @@ -6152,11 +6152,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);
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 9df8fada2dce..7736c96d5a78 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -6152,11 +6152,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);