[PATCH 02/11] fs/ntfs3: zero newly allocated clusters when the request is smaller than the frame

From: Konstantin Komarov

Date: Fri Oct 09 2026 - 13:22:46 EST


For compressed attributes, allocation is rounded up to a whole
compression frame, so a request covering only part of a frame still
allocates clst_per_frame clusters. The clusters outside the requested
range are then allocated but never written by the caller.

Until now 'zero' was set only when allocation had to start before the
requested VCN. When it started at vcn0 but extended past the end of
the request, the tail clusters were left holding whatever was
previously on disk.

Signed-off-by: Konstantin Komarov <almaz.alexandrovich@xxxxxxxxxxxxxxxxxxxx>
---
fs/ntfs3/attrib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ntfs3/attrib.c b/fs/ntfs3/attrib.c
index 3b4ef15162da..cd6d4b75d328 100644
--- a/fs/ntfs3/attrib.c
+++ b/fs/ntfs3/attrib.c
@@ -1164,7 +1164,7 @@ int attr_data_get_block_locked(struct ntfs_inode *ni, CLST vcn, CLST clen,
to_alloc = ((vcn0 + clen + clst_per_frame - 1) & cmask) - vcn;
if (fr < clst_per_frame)
fr = clst_per_frame;
- if (vcn != vcn0)
+ if (vcn != vcn0 || clen < to_alloc)
zero = true;

/* Check if 'vcn' and 'vcn0' in different attribute segments. */
--
2.43.0