| Message ID | 20260508121539.4174601-5-libaokun@linux.alibaba.com |
|---|---|
| State | Changes Requested |
| Headers | show
Return-Path:
<SRS0=qFRJ=DF=vger.kernel.org=linux-ext4+bounces-16364-patchwork-incoming=ozlabs.org@ozlabs.org>
X-Original-To: incoming@patchwork.ozlabs.org
Delivered-To: patchwork-incoming@legolas.ozlabs.org
Authentication-Results: legolas.ozlabs.org;
dkim=pass (1024-bit key;
unprotected) header.d=linux.alibaba.com header.i=@linux.alibaba.com
header.a=rsa-sha256 header.s=default header.b=ZiKMth1D;
dkim-atps=neutral
Authentication-Results: legolas.ozlabs.org;
spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org
(client-ip=2404:9400:2221:ea00::3; helo=mail.ozlabs.org;
envelope-from=srs0=qfrj=df=vger.kernel.org=linux-ext4+bounces-16364-patchwork-incoming=ozlabs.org@ozlabs.org;
receiver=patchwork.ozlabs.org)
Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange x25519 server-signature ECDSA (secp384r1 raw public key)
server-digest SHA384)
(No client certificate requested)
by legolas.ozlabs.org (Postfix) with ESMTPS id 4gBp9M6Yr5z1yKd
for <incoming@patchwork.ozlabs.org>; Fri, 08 May 2026 22:20:23 +1000 (AEST)
Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])
by gandalf.ozlabs.org (Postfix) with ESMTP id 4gBp9M5YxWz4wJg
for <incoming@patchwork.ozlabs.org>; Fri, 08 May 2026 22:20:23 +1000 (AEST)
Received: by gandalf.ozlabs.org (Postfix)
id 4gBp9M5SJ8z4wKD; Fri, 08 May 2026 22:20:23 +1000 (AEST)
Delivered-To: patchwork-incoming@ozlabs.org
Authentication-Results: gandalf.ozlabs.org;
arc=pass smtp.remote-ip="2600:3c0a:e001:db::12fc:5321"
arc.chain=subspace.kernel.org
ARC-Seal: i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1778242823; cv=pass;
b=uR81uCv2WZpKHkVhUmvHUj74ExwMKDoo9ygoTlvWyITYc4cReAK3quDFAU4fIQ0x0wQ7qc4oLFgyy1ZqgDsz/N7ahdWSoqmy6y/vkGVdOBnQjsa3Z1L3wFZ3nPrqKyZPnXRekUPG3JtLq1k7+hiAfkHAkC51TIq7wK+gHDoon/ubQhE8eZPSRm4s7RmOkYJ8hVmqG6nPZ1oVltLpInzMcwly1r5oJ2Z2E96Dr7u4bzKIhiVqwAOH210xR1lj1rwc7FG2uMvDWbUztsBaAbxORcfh/+2SHHnvKOVsBM2Y/q8bSIBhtAgDzzKp9YnGge0oFLeiKRHbynjee6plc4+wLQ==
ARC-Message-Signature: i=2; a=rsa-sha256; d=ozlabs.org; s=201707;
t=1778242823; c=relaxed/relaxed;
bh=UjyILuNe0LAhrUwcQd6OrpHIO74QHE8aSygiu8ENNoo=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version;
b=SfaNyneJpcojFNbDMaKzsNefZ8FmVpHwIFwsfHWhWgpLCdF8RMgoqLDQs4Bddg8aSaBIhstdfEeSqGujP5WLpyw3HzgtC8IR979lsSt8kUNU3GzCXC5uRF9QWoZgqAR6C/isVxW8jbAflMfi+utd+UrrQv5MgoaBW29ukX4tRbkldHvKvJjNquMaIebk5Q2NKvtT0Mn54fQ3zlrHTO1uh2gKTkv8Pgzwdm43FrCq7bDCH1L3HXoWytRclg4JcHtWOTg7XFFX/aFK3gjgcdDXt1jsoMLajlERafA+jeRrmwFG0S7beHOWgINoJM/AEcZmIjdxYwWTIsa+qAxIVR3H2w==
ARC-Authentication-Results: i=2; gandalf.ozlabs.org;
dmarc=pass (p=none dis=none) header.from=linux.alibaba.com;
dkim=pass (1024-bit key;
unprotected) header.d=linux.alibaba.com header.i=@linux.alibaba.com
header.a=rsa-sha256 header.s=default header.b=ZiKMth1D; dkim-atps=neutral;
spf=pass (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;
envelope-from=linux-ext4+bounces-16364-patchwork-incoming=ozlabs.org@vger.kernel.org;
receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org
Authentication-Results: gandalf.ozlabs.org;
dmarc=pass (p=none dis=none) header.from=linux.alibaba.com
Authentication-Results: gandalf.ozlabs.org;
dkim=pass (1024-bit key;
unprotected) header.d=linux.alibaba.com header.i=@linux.alibaba.com
header.a=rsa-sha256 header.s=default header.b=ZiKMth1D;
dkim-atps=neutral
Authentication-Results: gandalf.ozlabs.org;
spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org
(client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;
envelope-from=linux-ext4+bounces-16364-patchwork-incoming=ozlabs.org@vger.kernel.org;
receiver=ozlabs.org)
Received: from sea.lore.kernel.org (sea.lore.kernel.org
[IPv6:2600:3c0a:e001:db::12fc:5321])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange x25519)
(No client certificate requested)
by gandalf.ozlabs.org (Postfix) with ESMTPS id 4gBp9J2lC3z4wJg
for <patchwork-incoming@ozlabs.org>; Fri, 08 May 2026 22:20:20 +1000 (AEST)
Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org
[100.90.174.1])
by sea.lore.kernel.org (Postfix) with ESMTP id 0E0043091974
for <patchwork-incoming@ozlabs.org>; Fri, 8 May 2026 12:16:10 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 6999B35F162;
Fri, 8 May 2026 12:16:09 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=linux.alibaba.com
header.i=@linux.alibaba.com header.b="ZiKMth1D"
X-Original-To: linux-ext4@vger.kernel.org
Received: from out30-112.freemail.mail.aliyun.com
(out30-112.freemail.mail.aliyun.com [115.124.30.112])
(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 442BD37FF76;
Fri, 8 May 2026 12:16:05 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
arc=none smtp.client-ip=115.124.30.112
ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1778242569; cv=none;
b=K9Uz0OMQtBu/fxbcusAeuD+EFvg6iKFhZLZK0fAdInykbSOn2Hgn7GB42iQRiTyGMXNqo0BFrGYOOPXrUp1iUorBOMfDmEqZoevNLJBjMFKwW0by/TUhf8LS+yI66dlK2rwr0jDavCqJP3PbXHKd0pZEFk5npmRS0cIYOaQGvuA=
ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1778242569; c=relaxed/simple;
bh=eI+lnb4OIstw+TJ/gSUcTbk+6CPtXDvwn0TN344wuIA=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version;
b=ni/5Mmj2ipAKXuIUFWOny7Jty782J1O4IQcvQiOVEMn/rVgbYfHjYUt7uDkUVX52ubhhHaKM9cr5xcJ9pufPMAh/xEx+KqwblGLudf/59sK3n2YRww0aN+PRh4gVmg+NBd05Irlr3e45WJXi/eMquD/ieZEaqCUZ0Azfb4sLh5Y=
ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass (p=none dis=none) header.from=linux.alibaba.com;
spf=pass smtp.mailfrom=linux.alibaba.com;
dkim=pass (1024-bit key) header.d=linux.alibaba.com
header.i=@linux.alibaba.com header.b=ZiKMth1D;
arc=none smtp.client-ip=115.124.30.112
Authentication-Results: smtp.subspace.kernel.org;
dmarc=pass (p=none dis=none) header.from=linux.alibaba.com
Authentication-Results: smtp.subspace.kernel.org;
spf=pass smtp.mailfrom=linux.alibaba.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=linux.alibaba.com; s=default;
t=1778242563; h=From:To:Subject:Date:Message-ID:MIME-Version;
bh=UjyILuNe0LAhrUwcQd6OrpHIO74QHE8aSygiu8ENNoo=;
b=ZiKMth1DCl8veoBr+UFzIJ5EzNohOFnj4bjiPXxqtTwyff/Yg9egkJBaO/ylGUadrZtoxTt7oYSYDI1J2VMsMijbKI2/CCzQVW1OYoa6U8DxIgTHylqygdTZ7CnVQ3zbCf6erovoSOmXiin4X2b+2CBOydhNfCrvTX9FEGZ2a+Y=
X-Alimail-AntiSpam:
AC=PASS;BC=-1|-1;BR=01201311R251e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037026112;MF=libaokun@linux.alibaba.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---0X2XQgo7_1778242562;
Received: from
x31h02109.sqa.na131.tbsite.net(mailfrom:libaokun@linux.alibaba.com
fp:SMTPD_---0X2XQgo7_1778242562 cluster:ay36)
by smtp.aliyun-inc.com;
Fri, 08 May 2026 20:16:02 +0800
From: Baokun Li <libaokun@linux.alibaba.com>
To: linux-ext4@vger.kernel.org
Cc: linux-crypto@vger.kernel.org,
ebiggers@kernel.org,
ardb@kernel.org,
tytso@mit.edu,
adilger.kernel@dilger.ca,
jack@suse.cz,
yi.zhang@huawei.com,
ojaswin@linux.ibm.com,
ritesh.list@gmail.com,
Baokun Li <libaokun@linux.alibaba.com>
Subject: [PATCH RFC 04/17] ext4: fix incorrect block bitmap free clusters
update on metadata overlap
Date: Fri, 8 May 2026 20:15:26 +0800
Message-ID: <20260508121539.4174601-5-libaokun@linux.alibaba.com>
X-Mailer: git-send-email 2.43.7
In-Reply-To: <20260508121539.4174601-1-libaokun@linux.alibaba.com>
References: <20260508121539.4174601-1-libaokun@linux.alibaba.com>
Precedence: bulk
X-Mailing-List: linux-ext4@vger.kernel.org
List-Id: <linux-ext4.vger.kernel.org>
List-Subscribe: <mailto:linux-ext4+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:linux-ext4+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-8.7 required=5.0 tests=ARC_SIGNED,ARC_VALID,
DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DMARC_PASS,
HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,
SPF_PASS,UNPARSEABLE_RELAY,USER_IN_DEF_DKIM_WL autolearn=disabled
version=4.0.1
X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on gandalf.ozlabs.org
|
| Series |
ext4/lib-crc: LBS performance part 1 - incremental CRC32c for bitmap checksums
|
expand
|
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index ed1bd00e11cd..ff2023c9f52c 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -4228,7 +4228,7 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac, handle_t *handle ac->ac_b_ex.fe_group, ac->ac_b_ex.fe_start, ac->ac_b_ex.fe_len, - 0, NULL); + EXT4_MB_BITMAP_MARKED_CHECK, NULL); if (!err) err = -EFSCORRUPTED; return err;
In ext4_mb_mark_diskspace_used(), when the allocator detects that the allocated blocks overlap with filesystem metadata, it enters an error recovery path that marks these blocks as used in the bitmap via ext4_mb_mark_context() with flags=0. Without EXT4_MB_BITMAP_MARKED_CHECK, ext4_mb_mark_context() assumes all bits in the range will be flipped, so it sets changed=len unconditionally. However, in a corrupted filesystem, some of these metadata blocks may already be marked as used (bit=1) in the bitmap. Since mb_set_bits() is idempotent (sets bits to 1 regardless of current state), bits that are already set won't actually change, but the free clusters count is still decremented by the full range length, leading to an inaccurate free clusters count. Fix this by passing EXT4_MB_BITMAP_MARKED_CHECK, which correctly counts only the bits that actually changed state. Fixes: 2f94711b098b ("ext4: call ext4_mb_mark_context in ext4_mb_mark_diskspace_used") Signed-off-by: Baokun Li <libaokun@linux.alibaba.com> --- fs/ext4/mballoc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)