summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorLong Li <leo.lilong@huawei.com>2026-03-17 09:51:52 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-04-11 14:29:19 +0200
commitea0aeb3da35953f4eb5504bdb39f2d3ce6e709f9 (patch)
treea4590f15a88bbd22d37843c552af4e2b6dcf4666 /fs
parent05ac3754467363558a0a54ae4bb7c89b2c9574cf (diff)
xfs: only assert new size for datafork during truncate extents
commit e942498385bf80f4d6d075b47174035545eb6a2e upstream. The assertion functions properly because we currently only truncate the attr to a zero size. Any other new size of the attr is not preempted. Make this assertion is specific to the datafork, preparing for subsequent patches to truncate the attribute to a non-zero size. Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Long Li <leo.lilong@huawei.com> Signed-off-by: Carlos Maiolino <cem@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/xfs_inode.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index f1f88e48fe22..c98af0ffc315 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -1048,7 +1048,8 @@ xfs_itruncate_extents_flags(
xfs_assert_ilocked(ip, XFS_ILOCK_EXCL);
if (icount_read(VFS_I(ip)))
xfs_assert_ilocked(ip, XFS_IOLOCK_EXCL);
- ASSERT(new_size <= XFS_ISIZE(ip));
+ if (whichfork == XFS_DATA_FORK)
+ ASSERT(new_size <= XFS_ISIZE(ip));
ASSERT(tp->t_flags & XFS_TRANS_PERM_LOG_RES);
ASSERT(ip->i_itemp != NULL);
ASSERT(ip->i_itemp->ili_lock_flags == 0);