Re: [PATCH] ntfs: map a read past the end of the runlist as a hole
From: Namjae Jeon
Date: Thu Dec 03 2026 - 09:48:30 EST
On Wed, Dec 2, 2026 at 4:24 PM Zhan Xusheng <zhanxusheng1024@xxxxxxxxx> wrote:
>
> From: Zhan Xusheng <zhanxusheng@xxxxxxxxxx>
>
> ntfs_read_iomap_begin_non_resident() maps at most the rest of the run
> holding the offset. At or past the allocated size,
> ntfs_attr_vcn_to_rl() returns the end of the runlist, whose length is 0,
> so the rest of the run comes out negative and is returned as the length
> of the mapping:
>
> WARNING: fs/iomap/iter.c:39 at iomap_iter
> iomap_readahead
> ntfs_readahead
> read_pages
> page_cache_ra_unbounded
> do_page_cache_ra
> page_cache_ra_order
> filemap_fault
>
> Readahead gets there when the file shrinks after the readahead window
> was sized from i_size. "ntfs: trim the sizes after a short write"
> makes that easy to hit: a write that runs out of space is rolled back
> to what it wrote while a MAP_POPULATE mmap() of the file faults it in.
>
> Map the range past the end of the runlist as a hole.
>
> Fixes: b041ca562526 ("ntfs: update iomap and address space operations")
> Tested-by: syzbot@xxxxxxxxxxxxxxxxxxxxxxxxx
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Zhan Xusheng <zhanxusheng@xxxxxxxxxx>
Applied it to #ntfs-next.
Thanks!