From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB1C1C433FE for ; Mon, 21 Nov 2022 11:19:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229787AbiKULTY (ORCPT ); Mon, 21 Nov 2022 06:19:24 -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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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.