Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp4073405rwb; Mon, 21 Nov 2022 03:25:43 -0800 (PST) X-Google-Smtp-Source: AA0mqf5Mn5qUXvocDCLWOrsKwPuHIWbUs9D2o/hLaHIXhmEvfJ/o3Fq9gSxy1+G2054pSh8p/YN/ X-Received: by 2002:aa7:d358:0:b0:467:6847:1ea7 with SMTP id m24-20020aa7d358000000b0046768471ea7mr1101915edr.237.1669029943730; Mon, 21 Nov 2022 03:25:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669029943; cv=none; d=google.com; s=arc-20160816; b=BorduXpa8PWrs3zJK1OP2OOKRZWXJFd/5E8a5k1iLRcenxZ8sN7ZX+xrd7JWl/wRHx LSfy33zYsmyO+Iu1w7tK8ek+1vaXMohBmxiF6vMPaxTVbd7u7YZnIUI2MFHpMxPwEGEh g3xjNjb9sdNkVnAPBkLmBgy1RXOgYFyPU/SOLJgXKEZEOFuAUnZ/iz8iWXw1NOBDhVs6 Q6Gi0pfYTG+6DxGOTTqh4iafBmsMI2NfOjHx6JdDDceb1vB+ulMu/B9KYbfKyQ2tfWS2 MHPNgcKjsS+/ZkCNCneGg1q9Ox/miAVD9V61biqJN+WzjLSoh6N+2nA1IsAxMnUeH62B pr3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=2w3sabVrkSrnlF0bEYDPlqapWJ0tEB5O+n+BMUdlR0U=; b=twU5sHartprx6VAP61LnEhVxk7XCgabXZTL/JKL3cfDy4vix59WojBcktC1fDDyIPV teaquYQ8K6TfxSP4kog+eZAypjRRNnzbRkTLhVZCxpZ9FfLDVlGlK29h3nFZJ9db2dzb aBMkvRAqeMeG2O0y/IJoN4+jDBPSw+HgmI3p9ErTaipgsvy0MLVd3SxnvhMWJorzYQ+r KNPvsWwNaQ/dD1dICQLuvUcPmem2IflYkNuwBgLyDtE9Y142/AzBfXmfw+AaT/qn/fPs DkUEqjRXeftsiicyjR9fLBr2SmjRLfiBdxEIydTSYWAugKy7Up/rDPhRf85+Rk6LrL4H Gnew== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cr17-20020a170906d55100b00780a882d337si9451288ejc.480.2022.11.21.03.25.14; Mon, 21 Nov 2022 03:25:43 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230288AbiKULTU (ORCPT + 99 others); Mon, 21 Nov 2022 06:19:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230249AbiKULTA (ORCPT ); Mon, 21 Nov 2022 06:19:00 -0500 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68D43BEB45; Mon, 21 Nov 2022 03:14:18 -0800 (PST) Received: from canpemm500010.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4NG4Sk4j0xzFqSS; Mon, 21 Nov 2022 19:11:02 +0800 (CST) Received: from [10.174.178.185] (10.174.178.185) by canpemm500010.china.huawei.com (7.192.105.118) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 21 Nov 2022 19:14:16 +0800 Subject: Re: [PATCH 2/3] ext4: WANR_ON when detect abnormal 'i_reserved_data_blocks' To: Jan Kara , Ye Bin References: <20221117014246.610202-1-yebin@huaweicloud.com> <20221117014246.610202-3-yebin@huaweicloud.com> <20221121094715.gpha7rkijbwr5r47@quack3> CC: , , , From: "yebin (H)" Message-ID: <637B5D87.4000806@huawei.com> Date: Mon, 21 Nov 2022 19:14:15 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <20221121094715.gpha7rkijbwr5r47@quack3> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.178.185] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500010.china.huawei.com (7.192.105.118) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,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 On 2022/11/21 17:47, Jan Kara wrote: > On Thu 17-11-22 09:42:45, Ye Bin wrote: >> From: Ye Bin >> >> 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 >> --- >> 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.