Re: [PATCH 3/3] ntfs: do not refuse fallocate() when the MFT zone is empty

From: liubaolin

Date: Sun Sep 27 2026 - 14:12:15 EST




在 2026/9/27 18:57, Matthias Goergens 写道:
ntfs_fallocate() fails with -ENOSPC whenever the MFT zone has shrunk to
nothing. The cluster allocator gives the MFT zone up when it cannot
find free clusters elsewhere, and nothing restores it before the next
mount, so after one such failure every fallocate() on the volume fails
with ENOSPC, punching holes included, however much space is freed. The
allocator failure fixed by the previous patch was enough to get there:
afterwards a one-cluster fallocate() failed with ENOSPC while 123 MiB of
the 128 MiB volume were free.

write() and truncate() do not look at the MFT zone, and
ntfs_allocate_range() already fails with -ENOSPC when too few clusters
are free. Remove the check.

Fixes: 9c87959601e8 ("ntfs: update file operations")
Signed-off-by: Matthias Goergens <matthias.goergens@xxxxxxxxx>
---
fs/ntfs/file.c | 3 ---
1 file changed, 3 deletions(-)

diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c
index 3ec82715a5882..762045d262963 100644
--- a/fs/ntfs/file.c
+++ b/fs/ntfs/file.c
@@ -1163,9 +1163,6 @@ static long ntfs_fallocate(struct file *file, int mode, loff_t offset, loff_t le
if (!NVolFreeClusterKnown(vol))
wait_event(vol->free_waitq, NVolFreeClusterKnown(vol));
- if ((ni->vol->mft_zone_end - ni->vol->mft_zone_start) == 0)
- return -ENOSPC;
-
if (NInoNonResident(ni) && !NInoFullyMapped(ni)) {
down_write(&ni->runlist.lock);
err = ntfs_attr_map_whole_runlist(ni);

Looks good to me.

Reviewed-by: Baolin Liu <liubaolin@xxxxxxxxxx>