Message ID | 20221117014246.610202-3-yebin@huaweicloud.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp157657wrr; Wed, 16 Nov 2022 17:29:55 -0800 (PST) X-Google-Smtp-Source: AA0mqf6gz1mo2wZYDi4Ed/z50yKSHe9IlQ+FEUkdc4cvqqrikRmugYSxzAfoBOWps4owvyQDWMlz X-Received: by 2002:a17:906:85cc:b0:781:ee12:814 with SMTP id i12-20020a17090685cc00b00781ee120814mr393376ejy.63.1668648595702; Wed, 16 Nov 2022 17:29:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668648595; cv=none; d=google.com; s=arc-20160816; b=PbFsIjmmNx8Sn7Xvphf5jl9zxceSJdz4p3Zj7e0IfunAc/dyK8HywJz+020XUhb+0z PnhRENCAFov+7o9OMY/nMXtKyzSIMZ4vsQYmF0y9UNW/X9UcuXgUniwDT8xix9cMol5p 9ij+c33UHlwcHS6d+yQbrgxURrPrlkFDdiX/QRiMuruAXHCHz5GZENXsjA/IjgAHZP22 CpULQxf286AMzxUlWipBbWW3yhwzIxs0Bfv/aR5Isx+Z/mTNv6T/Z9y7CSnNQwAp1rcX 5fPR41oxsbFrxqWFM4dgXFGb4XEmUVy6sFHJp8ML0fQUK2K8+9IKEoMHu4PowAtWIA7P jsNw== 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=R+m+Gs77hK0M1qngwu5LOSZlel1K1QF+DsVCFLssPo0=; b=FHhqLM9Ee14dQlB81EBJdMdUaHqlww7j2Nz+efbftAJ2beobtYH34nCx2Q5fx97HNn FY0YLF+kL5dUNKB6U/CrQgbR8LoxULBN9jSWdPVOxURMv0fekHWLTMEOFrWn/+fISiAC vp0YnVEoC0z0DloNf1kJQkkZp/PT6HuppRG/ciQY7GmJNJSkAWRGhSH3m44DIJrkuqif ywE9aWeWxEVfzz/4HEsRhTKQACQpGTNuvs0U7qUptYuoYSGQkZQOKwWKRykZu913FjA2 OeNEEbB/pd9UjxrL5zWvXUGzJPrTxeLJuBdhW6le6UAbFZUwsiw561pRQlDLFkdhcku+ PwFg== 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 jg30-20020a170907971e00b007881b45441asi15724967ejc.721.2022.11.16.17.29.32; Wed, 16 Nov 2022 17:29:55 -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 S239082AbiKQBVt (ORCPT <rfc822;just.gull.subs@gmail.com> + 99 others); Wed, 16 Nov 2022 20:21:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238990AbiKQBVa (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 16 Nov 2022 20:21:30 -0500 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2387A1FCE2; Wed, 16 Nov 2022 17:21:28 -0800 (PST) Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4NCMZB1jtHz4f3jLS; Thu, 17 Nov 2022 09:21:22 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.127.227]) by APP4 (Coremail) with SMTP id gCh0CgAnmdaSjHVj0gCfAg--.26536S6; Thu, 17 Nov 2022 09:21:25 +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 2/3] ext4: WANR_ON when detect abnormal 'i_reserved_data_blocks' Date: Thu, 17 Nov 2022 09:42:45 +0800 Message-Id: <20221117014246.610202-3-yebin@huaweicloud.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221117014246.610202-1-yebin@huaweicloud.com> References: <20221117014246.610202-1-yebin@huaweicloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: gCh0CgAnmdaSjHVj0gCfAg--.26536S6 X-Coremail-Antispam: 1UD129KBjvdXoW7GF1fWw1fuF4kWw4UGFW7urg_yoWkGrgEq3 WUAF10vrWfXw4S9Fs5GrnxJrZYka1DCr18Ww4rKw15Zr10vF4DCw4qyry3Arn5Way8Gr90 9rW8Jry3GrWrWjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbskYFVCjjxCrM7AC8VAFwI0_Xr0_Wr1l1xkIjI8I6I8E6xAIw20E Y4v20xvaj40_JFC_Wr1l1IIY67AEw4v_Jr0_Jr4l82xGYIkIc2x26280x7IE14v26r15M2 8IrcIa0xkI8VCY1x0267AKxVW8JVW5JwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK 021l84ACjcxK6xIIjxv20xvE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r xl6s0DM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl 6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6x IIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_ Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr 1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE 14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7 IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E 87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73Uj IFyTuYvjxU2_MaUUUUU 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?1749704869667917408?= X-GMAIL-MSGID: =?utf-8?q?1749704869667917408?= |
Series |
Fix two issues about bigalloc feature
|
|
Commit Message
Ye Bin
Nov. 17, 2022, 1:42 a.m. UTC
From: Ye Bin <yebin10@huawei.com> If 'i_reserved_data_blocks' is not cleared which mean something wrong with code, so emit WARN_ON to capture this abnormal closer to the first scene. Signed-off-by: Ye Bin <yebin10@huawei.com> --- fs/ext4/super.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
Comments
On Thu 17-11-22 09:42:45, Ye Bin wrote: > From: Ye Bin <yebin10@huawei.com> > > If 'i_reserved_data_blocks' is not cleared which mean something wrong > with code, so emit WARN_ON to capture this abnormal closer to the first > scene. > > Signed-off-by: Ye Bin <yebin10@huawei.com> > --- > fs/ext4/super.c | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) > > diff --git a/fs/ext4/super.c b/fs/ext4/super.c > index 63ef74eb8091..30885a6fe18b 100644 > --- a/fs/ext4/super.c > +++ b/fs/ext4/super.c > @@ -1385,11 +1385,14 @@ static void ext4_destroy_inode(struct inode *inode) > dump_stack(); > } > > - if (EXT4_I(inode)->i_reserved_data_blocks) > - ext4_msg(inode->i_sb, KERN_ERR, > - "Inode %lu (%p): i_reserved_data_blocks (%u) not cleared!", > - inode->i_ino, EXT4_I(inode), > - EXT4_I(inode)->i_reserved_data_blocks); > + if (EXT4_I(inode)->i_reserved_data_blocks) { > + ext4_warning(inode->i_sb, "Inode %lu (%p): " > + "i_reserved_data_blocks (%u) not cleared!", > + inode->i_ino, EXT4_I(inode), > + EXT4_I(inode)->i_reserved_data_blocks); > + > + WARN_ON(1); > + } Hum, so I'd think that if this happens, the free space accounting is likely wrong so we might as well just force the filesystem to error mode with ext4_error() to force fsck? I also gives a good chance to various test systems to detect there is some problem so we don't need the WARN_ON then? What do others think? Honza
On 2022/11/21 17:47, Jan Kara wrote: > On Thu 17-11-22 09:42:45, Ye Bin wrote: >> From: Ye Bin <yebin10@huawei.com> >> >> If 'i_reserved_data_blocks' is not cleared which mean something wrong >> with code, so emit WARN_ON to capture this abnormal closer to the first >> scene. >> >> Signed-off-by: Ye Bin <yebin10@huawei.com> >> --- >> fs/ext4/super.c | 13 ++++++++----- >> 1 file changed, 8 insertions(+), 5 deletions(-) >> >> diff --git a/fs/ext4/super.c b/fs/ext4/super.c >> index 63ef74eb8091..30885a6fe18b 100644 >> --- a/fs/ext4/super.c >> +++ b/fs/ext4/super.c >> @@ -1385,11 +1385,14 @@ static void ext4_destroy_inode(struct inode *inode) >> dump_stack(); >> } >> >> - if (EXT4_I(inode)->i_reserved_data_blocks) >> - ext4_msg(inode->i_sb, KERN_ERR, >> - "Inode %lu (%p): i_reserved_data_blocks (%u) not cleared!", >> - inode->i_ino, EXT4_I(inode), >> - EXT4_I(inode)->i_reserved_data_blocks); >> + if (EXT4_I(inode)->i_reserved_data_blocks) { >> + ext4_warning(inode->i_sb, "Inode %lu (%p): " >> + "i_reserved_data_blocks (%u) not cleared!", >> + inode->i_ino, EXT4_I(inode), >> + EXT4_I(inode)->i_reserved_data_blocks); >> + >> + WARN_ON(1); >> + } > Hum, so I'd think that if this happens, the free space accounting is likely > wrong so we might as well just force the filesystem to error mode with > ext4_error() to force fsck? I also gives a good chance to various test > systems to detect there is some problem so we don't need the WARN_ON then? > What do others think? > > Honza Thanks for your advice, use ext4_error() maybe is suitable and also testable.
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 63ef74eb8091..30885a6fe18b 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -1385,11 +1385,14 @@ static void ext4_destroy_inode(struct inode *inode) dump_stack(); } - if (EXT4_I(inode)->i_reserved_data_blocks) - ext4_msg(inode->i_sb, KERN_ERR, - "Inode %lu (%p): i_reserved_data_blocks (%u) not cleared!", - inode->i_ino, EXT4_I(inode), - EXT4_I(inode)->i_reserved_data_blocks); + if (EXT4_I(inode)->i_reserved_data_blocks) { + ext4_warning(inode->i_sb, "Inode %lu (%p): " + "i_reserved_data_blocks (%u) not cleared!", + inode->i_ino, EXT4_I(inode), + EXT4_I(inode)->i_reserved_data_blocks); + + WARN_ON(1); + } } static void init_once(void *foo)