]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
xfs: fix freeing speculative preallocations for preallocated files
authorChristoph Hellwig <hch@lst.de>
Wed, 30 Apr 2025 21:27:01 +0000 (14:27 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 9 May 2025 07:41:38 +0000 (09:41 +0200)
commitdf403c882feb4e074d3a758c93a5d2a2c314ad3c
treefe6267b4efcae2b0d63bfaf02d14c49f69c93508
parent9e1ad0875ed82af6065d8591804e7150be37e4ba
xfs: fix freeing speculative preallocations for preallocated files

[ Upstream commit 610b29161b0aa9feb59b78dc867553274f17fb01 ]

xfs_can_free_eofblocks returns false for files that have persistent
preallocations unless the force flag is passed and there are delayed
blocks.  This means it won't free delalloc reservations for files
with persistent preallocations unless the force flag is set, and it
will also free the persistent preallocations if the force flag is
set and the file happens to have delayed allocations.

Both of these are bad, so do away with the force flag and always free
only post-EOF delayed allocations for files with the XFS_DIFLAG_PREALLOC
or APPEND flags set.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
Acked-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/xfs/xfs_bmap_util.c
fs/xfs/xfs_bmap_util.h
fs/xfs/xfs_icache.c
fs/xfs/xfs_inode.c