linux-stable/fs
Long Li 59b115a7e8 xfs: add lock protection when remove perag from radix tree
commit 07afd3173d upstream.

Take mp->m_perag_lock for deletions from the perag radix tree in
xfs_initialize_perag to prevent racing with tagging operations.
Lookups are fine - they are RCU protected so already deal with the
tree changing shape underneath the lookup - but tagging operations
require the tree to be stable while the tags are propagated back up
to the root.

Right now there's nothing stopping radix tree tagging from operating
while a growfs operation is progress and adding/removing new entries
into the radix tree.

Hence we can have traversals that require a stable tree occurring at
the same time we are removing unused entries from the radix tree which
causes the shape of the tree to change.

Likely this hasn't caused a problem in the past because we are only
doing append addition and removal so the active AG part of the tree
is not changing shape, but that doesn't mean it is safe. Just making
the radix tree modifications serialise against each other is obviously
correct.

Signed-off-by: Long Li <leo.lilong@huawei.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com>
Acked-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-04-03 15:28:48 +02:00
..
9p 9p: Fix initialisation of netfs_inode for 9p 2024-02-05 20:14:32 +00:00
adfs
affs
afs afs: Revert "afs: Hide silly-rename files from userspace" 2024-03-26 18:20:03 -04:00
autofs
befs
bfs
btrfs btrfs: fix off-by-one chunk length calculation at contains_pending_extent() 2024-04-03 15:28:26 +02:00
cachefiles cachefiles: fix memory leak in cachefiles_add_cache() 2024-03-01 13:35:00 +01:00
ceph ceph: stop copying to iter at EOF on sync reads 2024-03-26 18:20:11 -04:00
coda
configfs
cramfs
crypto
debugfs debugfs: fix automount d_fsdata usage 2024-01-20 11:51:37 +01:00
devpts
dlm dlm: fix user space lkb refcounting 2024-04-03 15:28:32 +02:00
ecryptfs ecryptfs: Reject casefold directory inodes 2024-02-05 20:14:17 +00:00
efivarfs efivarfs: Request at most 512 bytes for variable names 2024-03-06 14:48:41 +00:00
efs
erofs erofs: fix lockdep false positives on initializing erofs_pseudo_mnt 2024-03-26 18:19:40 -04:00
exfat exfat: support handle zero-size directory 2023-11-28 17:19:44 +00:00
exportfs
ext2 quota: Properly annotate i_dquot arrays with __rcu 2024-03-26 18:19:46 -04:00
ext4 ext4: fix corruption during on-line resize 2024-04-03 15:28:28 +02:00
f2fs f2fs: truncate page cache before clearing flags when aborting atomic write 2024-04-03 15:28:33 +02:00
fat fat: fix uninitialized field in nostale filehandles 2024-04-03 15:28:20 +02:00
freevxfs
fscache netfs, fscache: Prevent Oops in fscache_put_cache() 2024-01-31 16:19:01 -08:00
fuse fuse: don't unhash root 2024-04-03 15:28:25 +02:00
gfs2 gfs2: fix kernel BUG in gfs2_quota_cleanup 2024-01-25 15:35:17 -08:00
hfs
hfsplus
hostfs
hpfs
hugetlbfs mm: hugetlb pages should not be reserved by shmat() if SHM_NORESERVE 2024-02-23 09:25:16 +01:00
iomap iomap: clear the per-folio dirty bits on all writeback failures 2024-03-26 18:19:16 -04:00
isofs
jbd2 jbd2: fix soft lockup in journal_finish_inode_data_buffers() 2024-01-20 11:51:43 +01:00
jffs2
jfs quota: Properly annotate i_dquot arrays with __rcu 2024-03-26 18:19:46 -04:00
kernfs fs/kernfs/dir: obey S_ISGID 2024-02-05 20:14:32 +00:00
lockd
minix
netfs netfs: Only call folio_start_fscache() one time for each folio 2023-09-18 12:03:46 -07:00
nfs NFS: Read unlock folio on nfs_page_create_from_folio() error 2024-04-03 15:28:29 +02:00
nfs_common
nfsd NFSD: Fix nfsd_clid_class use of __string_len() macro 2024-04-03 15:28:35 +02:00
nilfs2 nilfs2: prevent kernel bug at submit_bh_wbc() 2024-04-03 15:28:34 +02:00
nls
notify fanotify: limit reporting of event with non-decodeable file handles 2023-10-19 16:19:20 +02:00
ntfs
ntfs3 fs/ntfs3: fix build without CONFIG_NTFS3_LZX_XPRESS 2024-03-02 18:23:09 +01:00
ocfs2 quota: Properly annotate i_dquot arrays with __rcu 2024-03-26 18:19:46 -04:00
omfs
openpromfs
orangefs
overlayfs ovl: Always reject mounting over case-insensitive directories 2024-03-26 18:19:18 -04:00
proc fs/proc: do_task_stat: move thread_group_cputime_adjusted() outside of lock_task_sighand() 2024-02-23 09:25:17 +01:00
pstore pstore: inode: Only d_invalidate() is needed 2024-03-26 18:19:34 -04:00
qnx4
qnx6
quota quota: Properly annotate i_dquot arrays with __rcu 2024-03-26 18:19:46 -04:00
ramfs
reiserfs quota: Properly annotate i_dquot arrays with __rcu 2024-03-26 18:19:46 -04:00
romfs
smb cifs: open_cached_dir(): add FILE_READ_EA to desired access 2024-04-03 15:28:35 +02:00
squashfs
sysfs
sysv
tracefs eventfs: Keep all directory links at 1 2024-02-23 09:25:25 +01:00
ubifs ubifs: Set page uptodate in the correct place 2024-04-03 15:28:20 +02:00
udf
ufs
unicode
vboxsf
verity
xfs xfs: add lock protection when remove perag from radix tree 2024-04-03 15:28:48 +02:00
zonefs zonefs: Improve error handling 2024-02-23 09:25:13 +01:00
aio.c fs/aio: Check IOCB_AIO_RW before the struct aio_kiocb conversion 2024-04-03 15:28:44 +02:00
anon_inodes.c
attr.c
bad_inode.c
binfmt_elf.c
binfmt_elf_fdpic.c fs: binfmt_elf_efpic: fix personality for ELF-FDPIC 2023-09-29 17:20:45 -07:00
binfmt_elf_test.c
binfmt_flat.c
binfmt_misc.c
binfmt_script.c
buffer.c iomap: add a workaround for racy i_size updates on block devices 2023-09-25 08:55:00 -07:00
char_dev.c
compat_binfmt_elf.c
coredump.c
d_path.c
dax.c mm: convert DAX lock/unlock page to lock/unlock folio 2024-01-10 17:16:53 +01:00
dcache.c fast_dput(): handle underflows gracefully 2024-02-05 20:14:26 +00:00
direct-io.c
drop_caches.c
eventfd.c
eventpoll.c
exec.c exec: Fix error handling in begin_new_exec() 2024-01-31 16:19:06 -08:00
fcntl.c fs: Fix rw_hint validation 2024-03-26 18:19:17 -04:00
fhandle.c do_sys_name_to_handle(): use kzalloc() to fix kernel-infoleak 2024-03-26 18:19:15 -04:00
file.c
file_table.c
filesystems.c
fs-writeback.c writeback, cgroup: switch inodes with dirty timestamps to release dying cgwbs 2023-11-20 11:58:52 +01:00
fs_context.c fs: factor out vfs_parse_monolithic_sep() helper 2023-10-12 18:53:36 +03:00
fs_parser.c
fs_pin.c
fs_struct.c
fs_types.c
fsopen.c
init.c
inode.c filemap: add a per-mapping stable writes flag 2023-12-03 07:33:03 +01:00
internal.h
ioctl.c lsm: new security_file_ioctl_compat() hook 2024-01-31 16:18:54 -08:00
Kconfig
Kconfig.binfmt
kernel_read_file.c
libfs.c fs: new accessor methods for atime and mtime 2024-01-05 15:19:40 +01:00
locks.c
Makefile
mbcache.c
mnt_idmapping.c
mount.h
mpage.c
namei.c rename(): fix the locking of subdirectories 2024-01-31 16:18:57 -08:00
namespace.c fs: relax mount_setattr() permission checks 2024-02-23 09:25:15 +01:00
nsfs.c
open.c cred: get rid of CONFIG_DEBUG_CREDENTIALS 2023-12-20 17:01:51 +01:00
pipe.c pipe: wakeup wr_wait after setting max_usage 2024-01-31 16:19:09 -08:00
pnode.c
pnode.h
posix_acl.c
proc_namespace.c
read_write.c
readdir.c
remap_range.c
select.c fs/select: rework stack allocation hack for clang 2024-03-26 18:19:17 -04:00
seq_file.c
signalfd.c
splice.c
stack.c
stat.c fs: Pass AT_GETATTR_NOSEC flag to getattr interface function 2023-12-03 07:33:03 +01:00
statfs.c
super.c
sync.c
sysctls.c
timerfd.c
userfaultfd.c
utimes.c
xattr.c