Re: [PATCH] ntfs: include the final partial cluster in sync writes

From: Namjae Jeon

Date: Tue Sep 22 2026 - 09:32:50 EST


On Tue, Sep 22, 2026 at 1:33 PM Karl Mehltretter <kmehltretter@xxxxxxxxx> wrote:
>
> ntfs_attrlist_repack() synchronously writes the replacement attribute
> list before updating its mapping pairs and freeing the old run. With
> 512-byte clusters, a 544-byte list submits a 512-byte bio, but the
> write returns 544 and repack accepts it as complete. If the later
> buffered update does not reach disk, the replacement list lacks its
> final 32 bytes.
>
> __ntfs_inode_non_resident_attr_pwrite() converts attr_len to clusters
> with ntfs_bytes_to_cluster(), which rounds down. Before repack, its
> synchronous callers used either cluster-aligned lengths or lengths
> smaller than one cluster, where max_t() selects one.
>
> Round attr_len up so repack writes the final partial cluster before
> publishing the new mapping pairs.
>
> Fixes: b1d732e62a5b ("ntfs: repack $MFT/$ATTRIBUTE LIST")
> Cc: stable@xxxxxxxxxxxxxxx
> Assisted-by: LLM
> Signed-off-by: Karl Mehltretter <kmehltretter@xxxxxxxxx>
Applied it to #ntfs-next.
Thanks!