From nobody Sun Jun 14 14:29:42 2026 Received: from out30-119.freemail.mail.aliyun.com (out30-119.freemail.mail.aliyun.com [115.124.30.119]) (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 7ABD9390982 for ; Fri, 3 Apr 2026 09:08:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.119 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775207295; cv=none; b=V8CD+Tvff/M/AhHLYEgz37oN8DT7tW8O17GCS5IdxKwVZGOLMQIiECNYNYkJUvSHjiilH+scjGHJcs5XEBNalETVvRF2DbTF9HaHJapYRKVQQZimy2YaFRzCFNcFoqZPWXrPabpC/j696nh5JevUIczem2vRiro4UBB3GLdlpDY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775207295; c=relaxed/simple; bh=X5aWtGjqDenZ9AOrYl+S/vhnAeXagWivNUJoo5DR29s=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=OQex603YABx2xyd0K4Ji7Byms1cXy2lTeQkWwnZ6pVkvLr9zkCYD3aqiKB62qbbN+T3WGK4dTPpZ6nRprfLU2keGJXn/jOlhIh7vWOzL69RSIA4xZ//Gv8wXTsq+21PI8gvParueXnqjshSrfQzo0p/TNe1Zdtgp65GNkNKGvUw= 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=TZAQsM5W; arc=none smtp.client-ip=115.124.30.119 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="TZAQsM5W" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1775207286; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=30xbXXjhK+DybaqKvQxJZhjgyjkrcOWsLr3QSd7mSDY=; b=TZAQsM5W/dYpv9+acyZvWuoA+eJSTiQlZdxdPHNh7r3tXJ7XLBk63fvbHCLk/mM/M7u7KCUQYDlOhVCQTDLESdFVy6aKrNYiXba6oVeUdGkiyvKIaEHXNb0ITTwtablfL6u5q65yYPwoenH+P9vswLusxdtny5L66GcSJ3XKv1I= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R441e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033045098064;MF=joseph.qi@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0X0JrROp_1775207285; Received: from localhost(mailfrom:joseph.qi@linux.alibaba.com fp:SMTPD_---0X0JrROp_1775207285 cluster:ay36) by smtp.aliyun-inc.com; Fri, 03 Apr 2026 17:08:05 +0800 From: Joseph Qi To: Andrew Morton , Heming Zhao , ZhengYuan Huang Cc: ocfs2-devel@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] ocfs2: validate dx_root extent list fields during block read Date: Fri, 3 Apr 2026 17:08:00 +0800 Message-Id: <20260403090803.3860971-2-joseph.qi@linux.alibaba.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20260403090803.3860971-1-joseph.qi@linux.alibaba.com> References: <20260403090803.3860971-1-joseph.qi@linux.alibaba.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 Content-Type: text/plain; charset="utf-8" Move the extent list l_count validation from ocfs2_dx_dir_lookup_rec() into ocfs2_validate_dx_root(), so that corrupted on-disk fields are caught early at block read time rather than during directory lookups. Additionally, add a l_next_free_rec <=3D l_count check to prevent out-of-bounds access when iterating over extent records. Both checks are skipped for inline dx roots (OCFS2_DX_FLAG_INLINE), which use dr_entries instead of dr_list. Signed-off-by: Joseph Qi Reviewed-by: Heming Zhao --- fs/ocfs2/dir.c | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index 1c8abf2c592c..82e720c8ba32 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c @@ -593,7 +593,7 @@ static int ocfs2_validate_dx_root(struct super_block *s= b, mlog(ML_ERROR, "Checksum failed for dir index root block %llu\n", (unsigned long long)bh->b_blocknr); - return ret; + goto bail; } =20 if (!OCFS2_IS_VALID_DX_ROOT(dx_root)) { @@ -601,8 +601,32 @@ static int ocfs2_validate_dx_root(struct super_block *= sb, "Dir Index Root # %llu has bad signature %.*s\n", (unsigned long long)le64_to_cpu(dx_root->dr_blkno), 7, dx_root->dr_signature); + goto bail; + } + + if (!(dx_root->dr_flags & OCFS2_DX_FLAG_INLINE)) { + struct ocfs2_extent_list *el =3D &dx_root->dr_list; + + if (le16_to_cpu(el->l_count) !=3D ocfs2_extent_recs_per_dx_root(sb)) { + ret =3D ocfs2_error(sb, + "Dir Index Root # %llu has invalid l_count %u (expected %u)\n", + (unsigned long long)le64_to_cpu(dx_root->dr_blkno), + le16_to_cpu(el->l_count), + ocfs2_extent_recs_per_dx_root(sb)); + goto bail; + } + + if (le16_to_cpu(el->l_next_free_rec) > le16_to_cpu(el->l_count)) { + ret =3D ocfs2_error(sb, + "Dir Index Root # %llu has invalid l_next_free_rec %u (l_count %u)\= n", + (unsigned long long)le64_to_cpu(dx_root->dr_blkno), + le16_to_cpu(el->l_next_free_rec), + le16_to_cpu(el->l_count)); + goto bail; + } } =20 +bail: return ret; } =20 @@ -791,14 +815,6 @@ static int ocfs2_dx_dir_lookup_rec(struct inode *inode, struct ocfs2_extent_block *eb; struct ocfs2_extent_rec *rec =3D NULL; =20 - if (le16_to_cpu(el->l_count) !=3D - ocfs2_extent_recs_per_dx_root(inode->i_sb)) { - ret =3D ocfs2_error(inode->i_sb, - "Inode %lu has invalid extent list length %u\n", - inode->i_ino, le16_to_cpu(el->l_count)); - goto out; - } - if (el->l_tree_depth) { ret =3D ocfs2_find_leaf(INODE_CACHE(inode), el, major_hash, &eb_bh); --=20 2.39.3 From nobody Sun Jun 14 14:29:42 2026 Received: from out30-98.freemail.mail.aliyun.com (out30-98.freemail.mail.aliyun.com [115.124.30.98]) (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 5D59C3909A0 for ; Fri, 3 Apr 2026 09:08:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.98 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775207296; cv=none; b=Vg+vyzEqs6O8+1Q3D6wABjwS3aP8f+z0L+nwAUkU+zlzKbWk+0MdRT/oRkihBObJMm3uATP3Em7B8AVnzX79msllW6TtEby8pYUrVtNKTtULhrHB1TEfsSeVFHK1CWJMvuBgEMMLIvjRokW4BFuS9phYnOEl/vgagEMfMuozUJ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775207296; c=relaxed/simple; bh=1S62142bTYfPOumsFslF2t1QjRSoZzuwBdjGTUQhpyY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=CkSnE4wAcn9DuOgeS/IHQy5XqnYI+ow49k7gnFpRBQG9vVsYWKMuAKIdwwrhXPGXUOALtgPCQof/Ejev0sC31GKd16tJ0D3MmTuW1HV5wj8Ow6b0e+9GwW/aKlfyKfcbCPoqUI0GmAE0qt6I1VEiGnD2qn/hAIlNkrQn3M6CknY= 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=Fuf0+KEf; arc=none smtp.client-ip=115.124.30.98 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="Fuf0+KEf" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1775207286; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=xWrwemNBl7XrecfOY+vjnq7eBphyhMoNrep2AfZ3TSk=; b=Fuf0+KEfTgb1Yx31JXdQkLldpGfevllYjqX6IowoE2cnJVK3y1hAQUEIn6MO/tnMdvbeyAqc4IGxAyajctazT2LAWXSqS01PRODVR7Hnkq9f/sXjHfSdjfaQDDsNrQZ5c9MvS3LVNDGRamxwU7tMziR1nvSGDbuF1LkpDNYNG0E= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R161e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033045133197;MF=joseph.qi@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0X0JqO83_1775207285; Received: from localhost(mailfrom:joseph.qi@linux.alibaba.com fp:SMTPD_---0X0JqO83_1775207285 cluster:ay36) by smtp.aliyun-inc.com; Fri, 03 Apr 2026 17:08:06 +0800 From: Joseph Qi To: Andrew Morton , Heming Zhao , ZhengYuan Huang Cc: ocfs2-devel@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] ocfs2: remove empty extent list check in ocfs2_dx_dir_lookup_rec() Date: Fri, 3 Apr 2026 17:08:01 +0800 Message-Id: <20260403090803.3860971-3-joseph.qi@linux.alibaba.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20260403090803.3860971-1-joseph.qi@linux.alibaba.com> References: <20260403090803.3860971-1-joseph.qi@linux.alibaba.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 Content-Type: text/plain; charset="utf-8" The full extent list check is introduced by commit 44acc46d182f, which is to avoid NULL pointer dereference if a dirent is not found. Reworking the error message to not reference rec. Instead, report major_hash being looked up and l_next_free_rec, which naturally covers both failure cases (empty extent list and no matching record) without needing a separate l_next_free_rec =3D=3D 0 guard. Signed-off-by: Joseph Qi Reviewed-by: Heming Zhao --- fs/ocfs2/dir.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index 82e720c8ba32..d94595a49923 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c @@ -835,14 +835,6 @@ static int ocfs2_dx_dir_lookup_rec(struct inode *inode, } } =20 - if (le16_to_cpu(el->l_next_free_rec) =3D=3D 0) { - ret =3D ocfs2_error(inode->i_sb, - "Inode %lu has empty extent list at depth %u\n", - inode->i_ino, - le16_to_cpu(el->l_tree_depth)); - goto out; - } - found =3D 0; for (i =3D le16_to_cpu(el->l_next_free_rec) - 1; i >=3D 0; i--) { rec =3D &el->l_recs[i]; @@ -855,10 +847,9 @@ static int ocfs2_dx_dir_lookup_rec(struct inode *inode, =20 if (!found) { ret =3D ocfs2_error(inode->i_sb, - "Inode %lu has bad extent record (%u, %u, 0) in btree\n", - inode->i_ino, - le32_to_cpu(rec->e_cpos), - ocfs2_rec_clusters(el, rec)); + "Inode %lu has no extent record for hash %u in btree (next_free_rec = %u)\n", + inode->i_ino, major_hash, + le16_to_cpu(el->l_next_free_rec)); goto out; } =20 --=20 2.39.3 From nobody Sun Jun 14 14:29:42 2026 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 AF21423D7F4 for ; Fri, 3 Apr 2026 09:08:09 +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=1775207291; cv=none; b=UVUNgQt/8C8Nx4WB+f0zjUt4LFi7QDfWBNHLMgs3QtDaqdxfhQmbe8DvFFIfj6O07HaWZRWnxQcBsG8XLbTh2V8ldx0ycaPuGmJqOBRo8sYTUpytjtmDqPhC7/v9XZ/TmTh+70htZdx0dNUOF5JqY27i9bDUmNVrMQPGXOjER7Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775207291; c=relaxed/simple; bh=3sXjutqgIKHS+W6WA2F3yrs2jEN20n7ZVeeWkwfD3UM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RBsVz2IylWh+sOliXLEx8loZbAgcLwKekQB3OMYMYte2aFEeQeAL8kcpnzxDO5f8gywNwxAUdjupeUJvoZ8uYKVAuAEGnaIaWsmFDWsDuGaX3eMUrE6aMuOIVxBTTaJDKagy9ckKHIDp41vQj1uL3kf6ATFCCWbtVmMwGaPVezM= 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=Um+jIB+p; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="Um+jIB+p" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1775207287; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=hlKPn4y+yxU2tcXJIzv72CtTy7V2nwR6H/B4diAaeZE=; b=Um+jIB+pjMnUoiX4EKG22uT7iX0jzI/ccFBp6mzofDQk7kknvRIVBQPYwznhdGpshPyPLJufAy0wleE5Cn0e1m+fz+MeQKrv/A+la3IDsviYVUNDf3Q8AbgogvAvNZHDUJJ395WjukVshu0yi8Qk4GeWF4EKM8s81rj47RNUIFI= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R311e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033032089153;MF=joseph.qi@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0X0JqO8O_1775207286; Received: from localhost(mailfrom:joseph.qi@linux.alibaba.com fp:SMTPD_---0X0JqO8O_1775207286 cluster:ay36) by smtp.aliyun-inc.com; Fri, 03 Apr 2026 17:08:07 +0800 From: Joseph Qi To: Andrew Morton , Heming Zhao , ZhengYuan Huang Cc: ocfs2-devel@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] ocfs2: validate extent block list fields during block read Date: Fri, 3 Apr 2026 17:08:02 +0800 Message-Id: <20260403090803.3860971-4-joseph.qi@linux.alibaba.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20260403090803.3860971-1-joseph.qi@linux.alibaba.com> References: <20260403090803.3860971-1-joseph.qi@linux.alibaba.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 Content-Type: text/plain; charset="utf-8" Add extent list validation to ocfs2_validate_extent_block() so that corrupted on-disk fields are caught early at block read time rather than during extent tree traversal. Two checks are added: - l_count must equal the expected value from ocfs2_extent_recs_per_eb(), catching blocks with a corrupted record count before any array iteration. - l_next_free_rec must not exceed l_count, preventing out-of-bounds access when iterating over extent records. Signed-off-by: Joseph Qi Reviewed-by: Heming Zhao --- fs/ocfs2/alloc.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index 344fd4d95fbc..8639806bcbb8 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c @@ -917,11 +917,32 @@ static int ocfs2_validate_extent_block(struct super_b= lock *sb, goto bail; } =20 - if (le32_to_cpu(eb->h_fs_generation) !=3D OCFS2_SB(sb)->fs_generation) + if (le32_to_cpu(eb->h_fs_generation) !=3D OCFS2_SB(sb)->fs_generation) { rc =3D ocfs2_error(sb, "Extent block #%llu has an invalid h_fs_generation of #%u\n", (unsigned long long)bh->b_blocknr, le32_to_cpu(eb->h_fs_generation)); + goto bail; + } + + if (le16_to_cpu(eb->h_list.l_count) !=3D ocfs2_extent_recs_per_eb(sb)) { + rc =3D ocfs2_error(sb, + "Extent block #%llu has invalid l_count %u (expected %u)\n", + (unsigned long long)bh->b_blocknr, + le16_to_cpu(eb->h_list.l_count), + ocfs2_extent_recs_per_eb(sb)); + goto bail; + } + + if (le16_to_cpu(eb->h_list.l_next_free_rec) > le16_to_cpu(eb->h_list.l_co= unt)) { + rc =3D ocfs2_error(sb, + "Extent block #%llu has invalid l_next_free_rec %u (l_count %u)\n", + (unsigned long long)bh->b_blocknr, + le16_to_cpu(eb->h_list.l_next_free_rec), + le16_to_cpu(eb->h_list.l_count)); + goto bail; + } + bail: return rc; } --=20 2.39.3 From nobody Sun Jun 14 14:29:42 2026 Received: from out30-132.freemail.mail.aliyun.com (out30-132.freemail.mail.aliyun.com [115.124.30.132]) (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 0F49238AC8C for ; Fri, 3 Apr 2026 09:08:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.132 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775207294; cv=none; b=jub9cl5lLKjE3E/Ve/VAmpRa4fQZagnRfm6dssaG0yWq+9t8QiWkV2s/4hMs4xRJz9Qf+CKWtNsbIUIQAB6ygSNIOlYs8L6fPZSWy159dQTOdkEks802gEaYhx+NYzEw9TvNgPrd7aRdiLahVW8HV4ub9lJJdRaRjuFChYjtahA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775207294; c=relaxed/simple; bh=9kuk44SM25nMs/1+zgEYpPfIKfNAvjiTqEybT+vzrXU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UYf1a0+UMprBfLyv3/ArMRuwF2c0/SLTtHlx5+7VdwOFFalnCfhODB8EukcM2wZIRXpfbSu5FHnN6AjlVfq4K80r8AZS6CVmlEB9Ird7utKJTBAYBOf8LOYZUMGkyGCBT2Bd/ZZk0OWW3FPFlNPL/i3Z8b06afmz3P0rtioF86s= 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=NApkv7vP; arc=none smtp.client-ip=115.124.30.132 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="NApkv7vP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1775207289; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=9u4i4CuYLhmblA3aqm/e9wXf2wX7ubkTsct3lQ7y2BQ=; b=NApkv7vPupscJMZt6A3ZMVK7jiZyd5RSTD9y+VE8g0w6qI5CqH5Kg0R9EoklP91SYVRpNyT0qYEDKLmvmqE2oUbY7yYRsvaJxnTBFb3ol9HxwYwSG0FFnbeepY9sjfCaq83tqtF9S06ojVaPwsrtWrCPXqcX1n1DpndZwWHhRNI= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R641e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037009110;MF=joseph.qi@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0X0JsYHD_1775207287; Received: from localhost(mailfrom:joseph.qi@linux.alibaba.com fp:SMTPD_---0X0JsYHD_1775207287 cluster:ay36) by smtp.aliyun-inc.com; Fri, 03 Apr 2026 17:08:08 +0800 From: Joseph Qi To: Andrew Morton , Heming Zhao , ZhengYuan Huang Cc: ocfs2-devel@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] ocfs2: remove redundant l_next_free_rec check in __ocfs2_find_path() Date: Fri, 3 Apr 2026 17:08:03 +0800 Message-Id: <20260403090803.3860971-5-joseph.qi@linux.alibaba.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20260403090803.3860971-1-joseph.qi@linux.alibaba.com> References: <20260403090803.3860971-1-joseph.qi@linux.alibaba.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 Content-Type: text/plain; charset="utf-8" The l_next_free_rec > l_count check after ocfs2_read_extent_block() in __ocfs2_find_path() is now redundant, as ocfs2_validate_extent_block() already performs this validation at block read time. Remove the duplicate check to avoid maintaining the same validation in two places. Signed-off-by: Joseph Qi Reviewed-by: Heming Zhao --- fs/ocfs2/alloc.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index 8639806bcbb8..08e137928080 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c @@ -1878,18 +1878,6 @@ static int __ocfs2_find_path(struct ocfs2_caching_in= fo *ci, eb =3D (struct ocfs2_extent_block *) bh->b_data; el =3D &eb->h_list; =20 - if (le16_to_cpu(el->l_next_free_rec) > - le16_to_cpu(el->l_count)) { - ocfs2_error(ocfs2_metadata_cache_get_super(ci), - "Owner %llu has bad count in extent list at block %llu (next free= =3D%u, count=3D%u)\n", - (unsigned long long)ocfs2_metadata_cache_owner(ci), - (unsigned long long)bh->b_blocknr, - le16_to_cpu(el->l_next_free_rec), - le16_to_cpu(el->l_count)); - ret =3D -EROFS; - goto out; - } - if (func) func(data, bh); } --=20 2.39.3