]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
fs/xfs: transition from deprecated .mmap hook to .mmap_prepare
authorLorenzo Stoakes <lorenzo.stoakes@oracle.com>
Mon, 16 Jun 2025 19:33:25 +0000 (20:33 +0100)
committerChristian Brauner <brauner@kernel.org>
Tue, 17 Jun 2025 11:47:44 +0000 (13:47 +0200)
commit6528d29b46d8835f0e7b8b66d052ffbaaf7d5d2d
tree90c9092b309c3c365fefb1ee3e58b9dac71adc3b
parent8c90ae8fe5e34a27c500abdff76111c24c321871
fs/xfs: transition from deprecated .mmap hook to .mmap_prepare

Since commit c84bf6dd2b83 ("mm: introduce new .mmap_prepare() file
callback"), the f_op->mmap() hook has been deprecated in favour of
f_op->mmap_prepare().

This callback is invoked in the mmap() logic far earlier, so error handling
can be performed more safely without complicated and bug-prone state
unwinding required should an error arise.

This hook also avoids passing a pointer to a not-yet-correctly-established
VMA avoiding any issues with referencing this data structure.

It rather provides a pointer to the new struct vm_area_desc descriptor type
which contains all required state and allows easy setting of required
parameters without any consideration needing to be paid to locking or
reference counts.

Note that nested filesystems like overlayfs are compatible with an
.mmap_prepare() callback since commit bb666b7c2707 ("mm: add mmap_prepare()
compatibility layer for nested file systems").

Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Link: https://lore.kernel.org/cba8b29ba5f225df8f63f50182d5f6e0fcf94456.1750099179.git.lorenzo.stoakes@oracle.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/xfs/xfs_file.c