WSL2-Linux-Kernel/fs/btrfs
Boris Burkov 2311fd0302 btrfs: retry block group reclaim without infinite loop
commit 4eb4e85c4f818491efc67e9373aa16b123c3f522 upstream.

If inc_block_group_ro systematically fails (e.g. due to ETXTBUSY from
swap) or btrfs_relocate_chunk systematically fails (from lack of
space), then this worker becomes an infinite loop.

At the very least, this strands the cleaner thread, but can also result
in hung tasks/RCU stalls on PREEMPT_NONE kernels and if the
reclaim_bgs_lock mutex is not contended.

I believe the best long term fix is to manage reclaim via work queue,
where we queue up a relocation on the triggering condition and re-queue
on failure. In the meantime, this is an easy fix to apply to avoid the
immediate pain.

Fixes: 7e27180994 ("btrfs: reinsert BGs failed to reclaim")
CC: stable@vger.kernel.org # 6.6+
Signed-off-by: Boris Burkov <boris@bur.io>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-05 09:14:34 +02:00
..
tests
Kconfig
Makefile
acl.c
async-thread.c
async-thread.h
backref.c btrfs: fix information leak in btrfs_ioctl_logical_to_ino() 2024-05-02 16:24:48 +02:00
backref.h
block-group.c btrfs: retry block group reclaim without infinite loop 2024-07-05 09:14:34 +02:00
block-group.h
block-rsv.c
block-rsv.h
btrfs_inode.h
check-integrity.c
check-integrity.h
compression.c
compression.h
ctree.c
ctree.h
delalloc-space.c
delalloc-space.h
delayed-inode.c btrfs: record delayed inode root in transaction 2024-04-27 17:05:22 +02:00
delayed-inode.h
delayed-ref.c
delayed-ref.h
dev-replace.c
dev-replace.h
dir-item.c
discard.c
discard.h
disk-io.c btrfs: fix leak of qgroup extent records after transaction abort 2024-07-05 09:14:13 +02:00
disk-io.h
export.c btrfs: export: handle invalid inode or root reference in btrfs_get_parent() 2024-04-13 13:01:44 +02:00
export.h
extent-io-tree.h
extent-tree.c
extent_io.c
extent_io.h
extent_map.c
extent_map.h
file-item.c
file.c
free-space-cache.c
free-space-cache.h
free-space-tree.c
free-space-tree.h
inode-item.c
inode.c btrfs: make btrfs_clear_delalloc_extent() free delalloc reserve 2024-05-17 11:50:54 +02:00
ioctl.c
locking.c
locking.h
lzo.c
misc.h
ordered-data.c
ordered-data.h
orphan.c
print-tree.c
print-tree.h
props.c
props.h
qgroup.c btrfs: qgroup: correctly model root qgroup rsv in convert 2024-04-17 11:15:16 +02:00
qgroup.h
raid56.c
raid56.h
rcu-string.h
reada.c
ref-verify.c
ref-verify.h
reflink.c
reflink.h
relocation.c
root-tree.c
scrub.c
send.c btrfs: fix kvcalloc() arguments order in btrfs_ioctl_send() 2024-05-17 11:51:01 +02:00
send.h
space-info.c
space-info.h
struct-funcs.c
subpage.c
subpage.h
super.c
sysfs.c
sysfs.h
transaction.c btrfs: always clear PERTRANS metadata during commit 2024-05-17 11:50:54 +02:00
transaction.h
tree-checker.c
tree-checker.h
tree-defrag.c
tree-log.c
tree-log.h
tree-mod-log.c
tree-mod-log.h
ulist.c
ulist.h
uuid-tree.c
verity.c
volumes.c btrfs: add missing mutex_unlock in btrfs_relocate_sys_chunks() 2024-05-17 11:51:03 +02:00
volumes.h
xattr.c
xattr.h
zlib.c
zoned.c
zoned.h
zstd.c