Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp1026951lqo; Sat, 11 May 2024 04:37:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVJeAiWWX0RWYgjAXbKeUIAX38fHjY5Pp5Vbq2vvrcCdGvK8FNq3l7GAn8N0S99pHAoBJk6BUdNoS9I6THohloM6PJ44lQ50SDlCkIhcQ== X-Google-Smtp-Source: AGHT+IEcIKosSxITi8knY1f367ZJX+C4eycjVm5EUr6EQASkO7vsdLmhG4PweuB9/LbTfJnMiGFO X-Received: by 2002:a05:6a21:3298:b0:1af:ac31:9b8b with SMTP id adf61e73a8af0-1afde09f44fmr6086271637.10.1715427451423; Sat, 11 May 2024 04:37:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715427451; cv=pass; d=google.com; s=arc-20160816; b=BsOn9JYZ5Sm2BlF62pgCbiEQ7AVrCh5bGXGgUzKQni+S6rctEOkTWqSXfUqeTAsO2K wSwjUNYivOedRA53uoJWgO8s0my7Bbalbb6hwxOzWwmDUCbGCl76/yetG25w4zTQP+bf UAyvB7FlA7Zu7/ngfgqeeEykciB1j3FoiQjsAfeNhT8mCG/hIBjCFKIZ/WtKoKpLTjee HSoQnm3rO2XnG9eOQCBCINecr79FEJ5jnsbnHhPec0RFXEX5WVcOhifQD13q/p6X+J8z lpRN4EToQmhlxKaNX7i8o6PHwUM85fIKrnNEsl6AaFYVMpuMJDeemfgYo2wTvRddHIp0 zbWQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=CzIv+ox4NPz5NV2IujMUSDoS2KyPGlEtNJzgim0Zvy4=; fh=/gW0yUFnRcFNkSCPxz8UjBHCGPgiCEguRpLIibqIEzc=; b=wkC0Q+FlhEFjJrNrrYOpBaDQzAFQobUlkd/Js+tbt8K41r9oizHRDWzA00kspka2F5 FfwxHLeRGQoydx7+JHjo1lqSuUstDodgs5ENavZ0mKkE3O7sylrIoib03fnD/QpBDtrg 7GiMlmLQM1IxSrn0IwDgximoMV93h01uuufoxSpuGZBQM5tLflLR+tyoNjdl3zB0Vx85 6VUnqtagJr4RtXrwc0bdJqzxONE3fXBkswpRABWgAisV7eoMevEXOnXRz9rfN0FNYFaz Er/K+AHKfsMaIbnlC+ANy1vwpKoHkMW+h9zSUrbz4o36hpJabbBW4wvb/4OcRNAva2WW ViSQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-ext4+bounces-2456-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-ext4+bounces-2456-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d2e1a72fcca58-6f4d2a72b6esi5505185b3a.34.2024.05.11.04.37.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 04:37:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4+bounces-2456-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-ext4+bounces-2456-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-ext4+bounces-2456-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 13B8A282021 for ; Sat, 11 May 2024 11:37:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 90DA55674A; Sat, 11 May 2024 11:37:11 +0000 (UTC) X-Original-To: linux-ext4@vger.kernel.org Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CBC1154FAD; Sat, 11 May 2024 11:37:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715427431; cv=none; b=KCBTq/w5pq8ICS67EVTCV46C4XIC4t9FmYDaLMu0rDrkB9JgxIjROq3V9GOGGa41o4K60fxMNjv/NlNPCCF2Q5eIShicfSuwEKXkFX6iVcLxLu2DE2QVtPeVP56ZWjLVWsGI0nqcCdmD/4rCW/o5EoG78+hTit+o+qev2htFok4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715427431; c=relaxed/simple; bh=jdmUxbzlHSWTfdmP9jgdk7cyaKCSoH9U3c70PqabuME=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WPxgtcG65rkTZgCSl9cbOK7te3X97gIitPWoM26mMB7zeDXq16cPf7c2EmJmZhy0mFEUA19cpPIQnREnuWdVuvg1m87NsyA1QngrDK8Gcb9R8V7HoOmwupi3V80QsiyBDzQAVI8Gb/Xky/N/5VniXnkgF5oBbWeSEoQbSjNHKiI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.216]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4Vc3cl4TNqz4f3lV7; Sat, 11 May 2024 19:36:55 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 99A051A1072; Sat, 11 May 2024 19:37:05 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP1 (Coremail) with SMTP id cCh0CgDHlxA+WD9mG0B4MQ--.22689S7; Sat, 11 May 2024 19:37:05 +0800 (CST) From: Zhang Yi To: linux-ext4@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz, ritesh.list@gmail.com, yi.zhang@huawei.com, yi.zhang@huaweicloud.com, chengzhihao1@huawei.com, yukuai3@huawei.com Subject: [PATCH v4 03/10] ext4: warn if delalloc counters are not zero on inactive Date: Sat, 11 May 2024 19:26:12 +0800 Message-Id: <20240511112619.3656450-4-yi.zhang@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240511112619.3656450-1-yi.zhang@huaweicloud.com> References: <20240511112619.3656450-1-yi.zhang@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:cCh0CgDHlxA+WD9mG0B4MQ--.22689S7 X-Coremail-Antispam: 1UD129KBjvJXoWxJr4UZFyDAFW7Kw4UXr4rGrg_yoW8XF47p3 srA3W8GF95WrykGan7Xw47Xr10ga1xKF48Gr4xWr1UZF98Ja4Sqr1UtFy5C3WjgrZ3Ar4F qa4rKr17uFyUG37anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUBE14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_JrWl82xGYIkIc2 x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2z4x0 Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F4UJw A2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq3wAS 0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2 IY67AKxVWUGVWUXwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0 Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628vn2kIc2 xKxwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v2 6r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkGc2 Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_ Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMI IF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JUCXdbUUUUU = X-CM-SenderInfo: d1lo6xhdqjqx5xdzvxpfor3voofrz/ From: Zhang Yi The per-inode i_reserved_data_blocks count the reserved delalloc blocks in a regular file, it should be zero when destroying the file. The per-fs s_dirtyclusters_counter count all reserved delalloc blocks in a filesystem, it also should be zero when umounting the filesystem. Now we have only an error message if the i_reserved_data_blocks is not zero, which is unable to be simply captured, so add WARN_ON_ONCE to make it more visable. Signed-off-by: Zhang Yi --- fs/ext4/super.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 044135796f2b..440dd54eea25 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -1343,6 +1343,9 @@ static void ext4_put_super(struct super_block *sb) ext4_group_desc_free(sbi); ext4_flex_groups_free(sbi); + + WARN_ON_ONCE(!ext4_forced_shutdown(sb) && + percpu_counter_sum(&sbi->s_dirtyclusters_counter)); ext4_percpu_param_destroy(sbi); #ifdef CONFIG_QUOTA for (int i = 0; i < EXT4_MAXQUOTAS; i++) @@ -1473,7 +1476,8 @@ static void ext4_destroy_inode(struct inode *inode) dump_stack(); } - if (EXT4_I(inode)->i_reserved_data_blocks) + if (!ext4_forced_shutdown(inode->i_sb) && + WARN_ON_ONCE(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), -- 2.39.2