Re: [PATCH v2] shmem: skip empty unmap ranges when punching holes
From: David Hildenbrand
Date: Fri Nov 06 2026 - 09:05:41 EST
On Thu, 05 Nov 2026 05:56:19 +0000, Hungyu Lin wrote:
> When a hole ends before the first page boundary, shmem_fallocate()
> calculates unmap_end as -1. Casting it to u64 makes the range check
> succeed even though the hole contains no complete pages.
>
> For example, punching one byte at offset zero calls unmap_mapping_range()
> with a zero length, which means unmap to the end of the file. The file
> contents are preserved outside the hole, but unrelated mappings are
> removed and must fault back in. This can be reproduced with fallocate -p
> -o 0 -l 1 on a mapped tmpfs file.
>
> [...]
Applied, thanks!
tree: mm/core.git
branch: shmem-7.5.misc
Applied patches will appear soon in mm-next, followed by linux-next.
Please report any outstanding bugs that were missed during review, so we
can either drop the patch series or decide how to fix it up.
It is encouraged to provide Acked-bys, Reviewed-bys, and Tested-bys even
though the patches have already been applied. If possible, patch trailers
will be updated.
Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. Further, this is not a guarantee that the
patches will go upstream. If in doubt, please check the listed branch.
[1/1] shmem: skip empty unmap ranges when punching holes
https://git.kernel.org/mm/core/c/bf87d3fe
--
Cheers,
David