Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5263034rwb; Mon, 21 Nov 2022 19:44:17 -0800 (PST) X-Google-Smtp-Source: AA0mqf5KAbP0PIkeP/lD2+Oh1mBmumjMUwMT4oszEk/uPMYl8eGPhFvNFoZFv2HpW4SJYU4hCAbD X-Received: by 2002:a17:90b:3696:b0:214:1df2:b566 with SMTP id mj22-20020a17090b369600b002141df2b566mr24264445pjb.147.1669088656802; Mon, 21 Nov 2022 19:44:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669088656; cv=none; d=google.com; s=arc-20160816; b=kd4dgWzvidRWCBqUHgnXTAd+BU6QHTa4gwHR4GZBseq0shjW3Fu50XQSvzCERgjGar Uo0p2hRMMW+Q+NA4d8uh8WB2Ott1uCjvTyZLGeXkNEKB2HHiy7Hbg+NTr9kiIRuWHXwF NGZj2g0uYICw7TJ9sVfLWe/G2kO0GvXGrS/EC6ra6uLLu6XkZhQVzx3GpPyckVm9kOQX NO3eG+mA+BviWQJq5JzoPRhLlx1RIQIMhVUFMpLR+6HGNwWiQoQCLs4UQ4QlEv0PVZv7 Az7DgPibs6CaoB/qN2v2hgzge4llSl9+8FwA096l0igE5xVE2CpQGaVrsdhrMTIaVSoq VhNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=z7I/A0iqrxZCljCTmfRtDGpoHSH6u01y29lbjq53MCQ=; b=pxrvi2u++43chDLzaTrMafpM81R8AdVsnq3likI8Be9rKAUFSF4uklZPRqSd6DfREr rbOGnKsKJ/OZ8pqBGvPp523j6W2c18hQsq80bFa9elt8x79SAuqtI0ICBhGIzxn1RSVt GPvqMOdq8G0J0Vlj+59hjq2s6CTphdticiF0yr3NJCw3H3f47aG7CPnenUf1AsQdp/7w pS2EUY79W8QX8nhjVD1ZZYxe4ajk25+Uq6H65cGPwNt3ib29Nm8u+iilqH9mr923kagc yRxSodt84t/gs8F+vttbSeqQ1BAiOkJLUlY1FgscXcq/Q8ztKNffKvVLVFRhh+HNYW3H BD/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ohhrabe+; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ik27-20020a170902ab1b00b0018928092ef6si2839923plb.431.2022.11.21.19.43.58; Mon, 21 Nov 2022 19:44:16 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ohhrabe+; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231844AbiKVDfL (ORCPT + 99 others); Mon, 21 Nov 2022 22:35:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232242AbiKVDfG (ORCPT ); Mon, 21 Nov 2022 22:35:06 -0500 Received: from mail-qk1-x734.google.com (mail-qk1-x734.google.com [IPv6:2607:f8b0:4864:20::734]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34827275D8; Mon, 21 Nov 2022 19:35:03 -0800 (PST) Received: by mail-qk1-x734.google.com with SMTP id z1so9462195qkl.9; Mon, 21 Nov 2022 19:35:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=z7I/A0iqrxZCljCTmfRtDGpoHSH6u01y29lbjq53MCQ=; b=ohhrabe+FDlS5639l+JpnC2ukjAMdb6bfuAIpTGswwg+DwmaBlvLdh7657mErGy9JW pDXaUaYDFF0QsQYXJCE7pMP+IgxJ8A3MZZiQYTgP9RJsjHQK6+Bc++LrpdpSvlChCBhC +XN97u/oTIhOOfr+ZOIKHpoqtAhqhXZ6lg6Rj/xpP+q/SwosP+uXmB4Qx1SlWilXs64Z 26mcqCQmR75sYPEKxq47fGVmrrEoNeo9ezI2rjzo3mAyZXmdbhHBbzsyb/SDRSdUQ+R/ QNsyVq3gk0kNjmVnH0Ie/9L+cLx3dCffvr2yYcrAocmd0Vz92yhkgA3PFzC5Kc+CZNa8 fajw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=z7I/A0iqrxZCljCTmfRtDGpoHSH6u01y29lbjq53MCQ=; b=tlx5lyoWXSwEpEdz6UBY7RC/EvroA9U7iea33dwg6cQsUAOR7VeYrF+sDKKDgc4BmR yIRYMdBdq3MkBnv8yTBeAFcUfoonIVpbm5l4atqBClc2mlc9VRo2pLHL8EFYLKvOX5rR VKvmsMOczpoFdhxQP+V1mEC72GmlHRyw2skLxtJ02SkQ4wGCkqevzVK2dYud3p/mKsOy Qe88caIbeDpU9H3Y3dGy9riPmaDsx6MKUbIx4ms5I9q2gES7ML/3IoareHR6YvRGgjoP 44G1exhGWP0s5sn8N4ViLcWebSjlhM9fUb/D+BP+QdQBUtyg0cv7oWaRDExGkwHiWw4h dy6A== X-Gm-Message-State: ANoB5pmATExUXtYsQUEskchMTeA3aLYgb8wnvpvitfTIEgVk47RhdCyM yEgGMZbPgMIS2fPR9iEJwW8= X-Received: by 2002:a37:8883:0:b0:6fa:93b1:8b6f with SMTP id k125-20020a378883000000b006fa93b18b6fmr19496035qkd.357.1669088102328; Mon, 21 Nov 2022 19:35:02 -0800 (PST) Received: from debian-BULLSEYE-live-builder-AMD64 (h96-61-90-13.cntcnh.broadband.dynamic.tds.net. [96.61.90.13]) by smtp.gmail.com with ESMTPSA id o22-20020ac872d6000000b00399edda03dfsm7537642qtp.67.2022.11.21.19.35.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Nov 2022 19:35:01 -0800 (PST) Date: Mon, 21 Nov 2022 22:34:59 -0500 From: Eric Whitney To: Ye Bin Cc: tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, jack@suse.cz, Ye Bin Subject: Re: [PATCH v2 2/3] ext4: record error when detect abnormal 'i_reserved_data_blocks' Message-ID: References: <20221121121434.1061725-1-yebin@huaweicloud.com> <20221121121434.1061725-3-yebin@huaweicloud.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221121121434.1061725-3-yebin@huaweicloud.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 * Ye Bin : > From: Ye Bin > > If 'i_reserved_data_blocks' is not cleared which mean something wrong with > code, free space accounting is likely wrong, according to Jan Kara's advice > use ext4_error() to record this abnormal let fsck to repair and also we can > capture this issue. > > Signed-off-by: Ye Bin > --- > fs/ext4/super.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/fs/ext4/super.c b/fs/ext4/super.c > index 0690e2e0b74d..3d30007502a4 100644 > --- a/fs/ext4/super.c > +++ b/fs/ext4/super.c > @@ -1387,10 +1387,9 @@ static void ext4_destroy_inode(struct inode *inode) > } > > if (EXT4_I(inode)->i_reserved_data_blocks) > - ext4_msg(inode->i_sb, KERN_ERR, Per the coding standard, IIRC, the string should not be split across lines for "greppability", so it should remain as is. It's always good to run checkpatch to catch stuff like this. > - "Inode %lu (%p): i_reserved_data_blocks (%u) not cleared!", > - inode->i_ino, EXT4_I(inode), > - EXT4_I(inode)->i_reserved_data_blocks); > + ext4_error(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); > } > > static void init_once(void *foo) This is an improvement over the first version. If i_reserved_data_blocks is non-zero, something is definitely broken, but it's perhaps less likely to indicate file system damage than if it hits zero while there are still outstanding delayed blocks (handled well elsewhere). So, it's not clear we need to escalate handling this case but it doesn't hurt, either. Eric > -- > 2.31.1 >