[PATCH v1 05/13] ntfs: preserve delalloc reservations when allocating holes

From: Baolin Liu

Date: Wed Dec 02 2026 - 23:06:28 EST


From: Baolin Liu <liubaolin@xxxxxxxxxx>

ntfs_attr_map_cluster() always tells the cluster allocator to consume a
delayed-allocation reservation, including when allocating holes for direct
writes or page_mkwrite. This bypasses the space reserved for buffered
writes and releases reservations that belong to those writes.

On an order-0 kernel, buffering 1 MiB to one file and filling the volume
through direct writes to another makes the buffered file's fsync fail
with ENOSPC and loses data.

Consume a reservation only for LCN_DELALLOC runs. Hole allocations must
respect outstanding reservations.

Fixes: 495e90fa3348 ("ntfs: update attrib operations")
Signed-off-by: Baolin Liu <liubaolin@xxxxxxxxxx>
---
fs/ntfs/attrib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ntfs/attrib.c b/fs/ntfs/attrib.c
index 17854043b716..ea3a477c0061 100644
--- a/fs/ntfs/attrib.c
+++ b/fs/ntfs/attrib.c
@@ -5488,7 +5488,7 @@ int ntfs_attr_map_cluster(struct ntfs_inode *ni, s64 vcn_start, s64 *lcn_start,
}

rlc = ntfs_cluster_alloc(vol, vcn, clu_count, lcn_seek_from, DATA_ZONE,
- false, true, true);
+ false, true, lcn == LCN_DELALLOC);
if (IS_ERR(rlc)) {
err = PTR_ERR(rlc);
goto out;