From nobody Fri Dec 19 11:32:25 2025 Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) (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 E84583A1A0; Mon, 18 Dec 2023 14:14:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4Sv1zn3y22z2mGxV; Mon, 18 Dec 2023 22:14:45 +0800 (CST) Received: from dggpeml500021.china.huawei.com (unknown [7.185.36.21]) by mail.maildlp.com (Postfix) with ESMTPS id B7C141402D0; Mon, 18 Dec 2023 22:14:51 +0800 (CST) Received: from huawei.com (10.175.127.227) by dggpeml500021.china.huawei.com (7.185.36.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 18 Dec 2023 22:14:51 +0800 From: Baokun Li To: CC: , , , , , , , , Subject: [PATCH 2/4] ext4: do not trim the group with corrupted block bitmap Date: Mon, 18 Dec 2023 22:18:12 +0800 Message-ID: <20231218141814.1477338-3-libaokun1@huawei.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20231218141814.1477338-1-libaokun1@huawei.com> References: <20231218141814.1477338-1-libaokun1@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500021.china.huawei.com (7.185.36.21) Content-Type: text/plain; charset="utf-8" Otherwise operating on an incorrupted block bitmap can lead to all sorts of unknown problems. Signed-off-by: Baokun Li Reviewed-by: Jan Kara --- fs/ext4/mballoc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index d72b5e3c92ec..a95fa6e2b0f9 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -6757,6 +6757,9 @@ __releases(ext4_group_lock_ptr(sb, e4b->bd_group)) bool set_trimmed =3D false; void *bitmap; =20 + if (unlikely(EXT4_MB_GRP_BBITMAP_CORRUPT(e4b->bd_info))) + return 0; + bitmap =3D e4b->bd_bitmap; if (start =3D=3D 0 && max >=3D ext4_last_grp_cluster(sb, e4b->bd_group)) set_trimmed =3D true; --=20 2.31.1