linux-stable/fs
Alistair Popple cbe298d82c fs/dax: remove PAGE_MAPPING_DAX_SHARED mapping flag
The page ->mapping pointer can have magic values like
PAGE_MAPPING_DAX_SHARED and PAGE_MAPPING_ANON for page owner specific
usage.  Currently PAGE_MAPPING_DAX_SHARED and PAGE_MAPPING_ANON alias to
the same value.  This isn't a problem because FS DAX pages are never seen
by the anonymous mapping code and vice versa.

However a future change will make FS DAX pages more like normal pages, so
folio_test_anon() must not return true for a FS DAX page.

We could explicitly test for a FS DAX page in folio_test_anon(), etc. 
however the PAGE_MAPPING_DAX_SHARED flag isn't actually needed.  Instead
we can use the page->mapping field to implicitly track the first mapping
of a page.  If page->mapping is non-NULL it implies the page is associated
with a single mapping at page->index.  If the page is associated with a
second mapping clear page->mapping and set page->share to 1.

This is possible because a shared mapping implies the file-system
implements dax_holder_operations which makes the ->mapping and ->index,
which is a union with ->share, unused.

The page is considered shared when page->mapping == NULL and page->share >
0 or page->mapping != NULL, implying it is present in at least one address
space.  This also makes it easier for a future change to detect when a
page is first mapped into an address space which requires special
handling.

Link: https://lkml.kernel.org/r/c22f699202db0acee2f7039eb026e68261ce42d6.1740713401.git-series.apopple@nvidia.com
Signed-off-by: Alistair Popple <apopple@nvidia.com>
Tested-by: Alison Schofield <alison.schofield@intel.com>
Cc: Asahi Lina <lina@asahilina.net>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Chunyan Zhang <zhang.lyra@gmail.com>
Cc: Dan Wiliams <dan.j.williams@intel.com>
Cc: "Darrick J. Wong" <djwong@kernel.org>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Dave Jiang <dave.jiang@intel.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Ira Weiny <ira.weiny@intel.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: linmiaohe <linmiaohe@huawei.com>
Cc: Logan Gunthorpe <logang@deltatee.com>
Cc: Matthew Wilcow (Oracle) <willy@infradead.org>
Cc: Michael "Camp Drill Sergeant" Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Ted Ts'o <tytso@mit.edu>
Cc: Vishal Verma <vishal.l.verma@intel.com>
Cc: WANG Xuerui <kernel@xen0n.name>
Cc: Will Deacon <will@kernel.org>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Balbir Singh <balbirs@nvidia.com>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Jason Gunthorpe <jgg@nvidia.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2025-03-17 22:06:38 -07:00
..
9p
adfs
affs affs: don't write overlarge OFS data block size fields 2025-02-26 15:20:57 +01:00
afs afs: Give an afs_server object a ref on the afs_cell object it points to 2025-02-21 15:06:29 -08:00
autofs
bcachefs percpu: use TYPEOF_UNQUAL() in variable declarations 2025-03-16 22:05:53 -07:00
befs
bfs
btrfs for-6.14-rc5-tag 2025-03-07 11:17:30 -10:00
cachefiles
ceph
coda
configfs
cramfs
crypto
debugfs
devpts
dlm
ecryptfs
efivarfs efivarfs: allow creation of zero length files 2025-02-27 11:27:49 +01:00
efs
erofs
exfat exfat: add a check for invalid data size 2025-03-05 21:53:20 +09:00
exportfs
ext2
ext4 fs/dax: ensure all pages are idle prior to filesystem unmount 2025-03-17 22:06:38 -07:00
f2fs
fat
freevxfs
fuse fs/dax: create a common implementation to break DAX layouts 2025-03-17 22:06:37 -07:00
gfs2
hfs
hfsplus
hostfs
hpfs
hugetlbfs
iomap fs: convert block_commit_write() to take a folio 2025-03-16 22:06:22 -07:00
isofs
jbd2
jffs2
jfs
kernfs
lockd
minix
netfs netfs: Fix setting NETFS_RREQ_ALL_QUEUED to be after all subreqs queued 2025-02-13 16:00:48 +01:00
nfs 33 hotfixes. 24 are cc:stable and the remainder address post-6.13 issues 2025-03-08 14:34:06 -10:00
nfs_common
nfsd
nilfs2
nls
notify
ntfs3
ocfs2 fs: convert block_commit_write() to take a folio 2025-03-16 22:06:22 -07:00
omfs
openpromfs
orangefs
overlayfs ovl: fix UAF in ovl_dentry_update_reval by moving dput() in ovl_link_up 2025-02-19 18:06:53 +01:00
proc fs/proc/task_mmu: reduce scope of lazy mmu region 2025-03-17 00:05:34 -07:00
pstore
qnx4
qnx6
quota
ramfs
romfs
smb cifs: fix incorrect validation for num_aces field of smb_acl 2025-03-02 22:50:54 -06:00
squashfs squashfs: fix invalid pointer dereference in squashfs_cache_delete 2025-03-16 17:40:24 -07:00
sysfs
sysv
tests
tracefs
ubifs
udf fs: convert block_commit_write() to take a folio 2025-03-16 22:06:22 -07:00
ufs
unicode
vboxsf
verity
xfs fs/dax: ensure all pages are idle prior to filesystem unmount 2025-03-17 22:06:38 -07:00
zonefs
aio.c
anon_inodes.c
attr.c
backing-file.c
bad_inode.c
binfmt_elf_fdpic.c
binfmt_elf.c
binfmt_flat.c
binfmt_misc.c
binfmt_script.c
bpf_fs_kfuncs.c
buffer.c fs: convert block_commit_write() to take a folio 2025-03-16 22:06:22 -07:00
char_dev.c
compat_binfmt_elf.c
coredump.c coredump: Only sort VMAs when core_sort_vma sysctl is set 2025-02-24 10:51:57 -08:00
d_path.c
dax.c fs/dax: remove PAGE_MAPPING_DAX_SHARED mapping flag 2025-03-17 22:06:38 -07:00
dcache.c
direct-io.c
drop_caches.c
eventfd.c
eventpoll.c
exec.c
fcntl.c
fhandle.c
file_table.c
file.c
filesystems.c
fs_context.c
fs_parser.c
fs_pin.c
fs_struct.c
fs_types.c
fs-writeback.c
fsopen.c
init.c
inode.c
internal.h
ioctl.c
Kconfig mm/sparse: allow for alternate vmemmap section init at boot 2025-03-16 22:06:27 -07:00
Kconfig.binfmt
kernel_read_file.c
libfs.c
locks.c
Makefile
mbcache.c
mnt_idmapping.c
mount.h
mpage.c
namei.c fuse: don't truncate cached, mutated symlink 2025-02-20 15:48:17 +01:00
namespace.c
nsfs.c nsfs: remove d_op->d_delete 2025-02-24 11:30:35 +01:00
open.c
pidfs.c pidfs: remove d_op->d_delete 2025-02-24 11:27:02 +01:00
pipe.c fs/pipe: add simpler helpers for common cases 2025-03-06 18:25:35 -10:00
pnode.c
pnode.h
posix_acl.c
proc_namespace.c
read_write.c
readdir.c
remap_range.c
select.c
seq_file.c
signalfd.c
splice.c fs/pipe: add simpler helpers for common cases 2025-03-06 18:25:35 -10:00
stack.c
stat.c
statfs.c
super.c
sync.c
sysctls.c
timerfd.c
userfaultfd.c
utimes.c
xattr.c