linux-stable/fs/bcachefs
Kent Overstreet 87b0d8d3d0 bcachefs: Fix a journal deadlock in replay
Recently, journal pre-reservations were removed. They were for reserving
space ahead of time in the journal for operations that are required for
journal reclaim, e.g. btree key cache flushing and interior node btree
updates.

Instead we have watermarks - only operations for journal reclaim are
allowed when the journal is low on space, and in general we're quite
good about doing operations in the order that will free up space in the
journal quickest when we're low on space. If we're doing a journal
reclaim operation out of order, we usually do it in nonblocking mode if
it's not freeing up space at the end of the journal.

There's an exceptino though - interior btree node update operations have
to be BCH_WATERMARK_reclaim - once they've been started, and they can't
be nonblocking. Generally this is fine because they'll only be a very
small fraction of transaction commits - but there's an exception, which
is during journal replay.

Journal replay does many btree operations, but doesn't need to commit
them to the journal since they're already in the journal. So killing off
of pre-reservation, plus another change to make journal replay more
efficient by initially doing the replay in sorted btree order, made it
possible for the interior update operations replay generates to fill and
deadlock the journal.

Fix this by introducing a new check on journal space at the _start_ of
an interior update operation. This causes us to block if necessary in
exactly the same way as we used to when interior updates took a journal
pre-reservaiton, but without all the expensive accounting
pre-reservations required.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-12-04 16:04:55 -05:00
..
acl.c
acl.h
alloc_background.c bcachefs: use swab40 for bch_backpointer.bucket_offset bitfield 2023-11-04 22:19:13 -04:00
alloc_background.h
alloc_foreground.c bcachefs: deallocate_extra_replicas() 2023-11-24 03:03:47 -05:00
alloc_foreground.h
alloc_types.h
backpointers.c bcachefs: Fix null ptr deref in bch2_backpointer_get_node() 2023-11-13 21:42:22 -05:00
backpointers.h bcachefs: use swab40 for bch_backpointer.bucket_offset bitfield 2023-11-04 22:19:13 -04:00
bbpos.h
bbpos_types.h
bcachefs.h bcachefs: Fix zstd compress workspace size 2023-11-28 17:18:24 -05:00
bcachefs_format.h bcachefs: trace_move_extent_start_fail() now includes errcode 2023-11-28 17:18:24 -05:00
bcachefs_ioctl.h
bkey.c
bkey.h bcachefs: bkey_copy() is no longer a macro 2023-11-05 13:12:18 -05:00
bkey_buf.h
bkey_cmp.h
bkey_methods.c bcachefs: rebalance_work btree is not a snapshots btree 2023-11-04 22:19:13 -04:00
bkey_methods.h
bkey_sort.c bcachefs: bkey_copy() is no longer a macro 2023-11-05 13:12:18 -05:00
bkey_sort.h
bset.c
bset.h
btree_cache.c bcachefs: Don't drop journal pins in exit path 2023-12-03 12:44:18 -05:00
btree_cache.h
btree_gc.c bcachefs: Convert gc_alloc_start() to for_each_btree_key2() 2023-11-28 22:58:22 -05:00
btree_gc.h
btree_io.c bcachefs: Don't drop journal pins in exit path 2023-12-03 12:44:18 -05:00
btree_io.h bcachefs: Don't drop journal pins in exit path 2023-12-03 12:44:18 -05:00
btree_iter.c bcachefs: Proper refcounting for journal_keys 2023-11-24 02:43:12 -05:00
btree_iter.h bcachefs: Add a comment for BTREE_INSERT_NOJOURNAL usage 2023-11-04 22:19:13 -04:00
btree_journal_iter.c bcachefs: Proper refcounting for journal_keys 2023-11-24 02:43:12 -05:00
btree_journal_iter.h bcachefs: Proper refcounting for journal_keys 2023-11-24 02:43:12 -05:00
btree_key_cache.c bcachefs: Don't drop journal pins in exit path 2023-12-03 12:44:18 -05:00
btree_key_cache.h
btree_key_cache_types.h bcachefs: Run btree key cache shrinker less aggressively 2023-11-13 21:45:01 -05:00
btree_locking.c bcachefs: Ensure srcu lock is not held too long 2023-11-04 14:17:11 -04:00
btree_locking.h
btree_trans_commit.c bcachefs: Kill journal pre-reservations 2023-11-14 23:44:43 -05:00
btree_types.h bcachefs: Don't decrease BTREE_ITER_MAX when LOCKDEP=y 2023-11-14 23:44:44 -05:00
btree_update.c bcachefs; Don't use btree write buffer until journal replay is finished 2023-12-04 15:46:31 -05:00
btree_update.h
btree_update_interior.c bcachefs: Fix a journal deadlock in replay 2023-12-04 16:04:55 -05:00
btree_update_interior.h bcachefs: Kill journal pre-reservations 2023-11-14 23:44:43 -05:00
btree_write_buffer.c
btree_write_buffer.h
btree_write_buffer_types.h
buckets.c bcachefs: Fix bucket data type for stripe buckets 2023-11-28 17:18:24 -05:00
buckets.h
buckets_types.h
buckets_waiting_for_journal.c
buckets_waiting_for_journal.h
buckets_waiting_for_journal_types.h
chardev.c
chardev.h
checksum.c
checksum.h
clock.c
clock.h
clock_types.h
compress.c bcachefs: Fix zstd compress workspace size 2023-11-28 17:18:24 -05:00
compress.h
counters.c
counters.h
darray.h bcachefs: Convert bch2_fs_open() to darray 2023-11-05 13:12:17 -05:00
data_update.c bcachefs: Data update path won't accidentaly grow replicas 2023-11-25 21:48:42 -05:00
data_update.h bcachefs: Data update path won't accidentaly grow replicas 2023-11-25 21:48:42 -05:00
debug.c
debug.h
dirent.c
dirent.h
disk_groups.c bcachefs: Fix potential sleeping during mount 2023-11-14 23:44:43 -05:00
disk_groups.h
disk_groups_types.h
ec.c bcachefs: Guard against insufficient devices to create stripes 2023-11-13 21:42:22 -05:00
ec.h bcachefs: bch2_ec_read_extent() now takes btree_trans 2023-11-05 13:13:57 -05:00
ec_types.h
errcode.c
errcode.h bcachefs: Add missing validation for jset_entry_data_usage 2023-11-28 17:18:24 -05:00
error.c
error.h
extent_update.c
extent_update.h
extents.c bcachefs: Fix ec + durability calculation 2023-11-25 21:48:42 -05:00
extents.h
extents_types.h
eytzinger.h
fifo.h
fs-common.c bcachefs: x-macro-ify inode flags enum 2023-11-05 13:12:18 -05:00
fs-common.h
fs-io-buffered.c bcachefs: allow writeback to fill bio completely 2023-11-04 22:19:13 -04:00
fs-io-buffered.h
fs-io-direct.c closures: CLOSURE_CALLBACK() to fix type punning 2023-11-24 00:29:58 -05:00
fs-io-direct.h
fs-io-pagecache.c bcachefs: Use correct fgf_t type as function argument 2023-11-13 21:42:21 -05:00
fs-io-pagecache.h bcachefs: Use correct fgf_t type as function argument 2023-11-13 21:42:21 -05:00
fs-io.c
fs-io.h
fs-ioctl.c bcachefs: x-macro-ify inode flags enum 2023-11-05 13:12:18 -05:00
fs-ioctl.h bcachefs: x-macro-ify inode flags enum 2023-11-05 13:12:18 -05:00
fs.c bcachefs: preserve device path as device name 2023-11-24 02:42:07 -05:00
fs.h
fsck.c bcachefs: Fix bch2_check_nlinks() for snapshots 2023-11-14 23:44:44 -05:00
fsck.h
inode.c bcachefs: Fix missing transaction commit 2023-11-14 23:44:43 -05:00
inode.h bcachefs: x-macro-ify inode flags enum 2023-11-05 13:12:18 -05:00
io_misc.c
io_misc.h
io_read.c bcachefs: Data update path won't accidentaly grow replicas 2023-11-25 21:48:42 -05:00
io_read.h
io_write.c closures: CLOSURE_CALLBACK() to fix type punning 2023-11-24 00:29:58 -05:00
io_write.h closures: CLOSURE_CALLBACK() to fix type punning 2023-11-24 00:29:58 -05:00
io_write_types.h
journal.c bcachefs: move journal seq assertion 2023-11-28 22:58:22 -05:00
journal.h bcachefs: move journal seq assertion 2023-11-28 22:58:22 -05:00
journal_io.c bcachefs: Add missing validation for jset_entry_data_usage 2023-11-28 17:18:24 -05:00
journal_io.h closures: CLOSURE_CALLBACK() to fix type punning 2023-11-24 00:29:58 -05:00
journal_reclaim.c bcachefs: Kill journal pre-reservations 2023-11-14 23:44:43 -05:00
journal_reclaim.h
journal_sb.c
journal_sb.h
journal_seq_blacklist.c
journal_seq_blacklist.h
journal_types.h bcachefs: Kill journal pre-reservations 2023-11-14 23:44:43 -05:00
Kconfig bcachefs: Put erasure coding behind an EXPERIMENTAL kconfig option 2023-11-24 00:29:58 -05:00
keylist.c
keylist.h
keylist_types.h
logged_ops.c
logged_ops.h
lru.c
lru.h
Makefile
mean_and_variance.c
mean_and_variance.h
mean_and_variance_test.c
migrate.c
migrate.h
move.c bcachefs: Extra kthread_should_stop() calls for copygc 2023-11-28 22:58:23 -05:00
move.h bcachefs: Make sure bch2_move_ratelimit() also waits for move_ops 2023-11-24 02:10:28 -05:00
move_types.h
movinggc.c bcachefs: Extra kthread_should_stop() calls for copygc 2023-11-28 22:58:23 -05:00
movinggc.h
nocow_locking.c
nocow_locking.h
nocow_locking_types.h
opts.c bcachefs: Replace ERANGE with private error codes 2023-11-05 13:12:18 -05:00
opts.h
printbuf.c
printbuf.h
quota.c
quota.h
quota_types.h
rebalance.c bcachefs: Data move path now uses bch2_trans_unlock_long() 2023-11-04 22:19:11 -04:00
rebalance.h
rebalance_types.h
recovery.c bcachefs: Proper refcounting for journal_keys 2023-11-24 02:43:12 -05:00
recovery.h
recovery_types.h
reflink.c
reflink.h
replicas.c bcachefs: Add missing validation for jset_entry_data_usage 2023-11-28 17:18:24 -05:00
replicas.h bcachefs: Add missing validation for jset_entry_data_usage 2023-11-28 17:18:24 -05:00
replicas_types.h
sb-clean.c bcachefs: Don't iterate over journal entries just for btree roots 2023-11-05 13:12:18 -05:00
sb-clean.h
sb-errors.c bcachefs: bch2_prt_datetime() 2023-11-05 13:12:08 -05:00
sb-errors.h
sb-errors_types.h
sb-members.c bcachefs: Move __bch2_members_v2_get_mut to sb-members.h 2023-11-05 13:12:17 -05:00
sb-members.h bcachefs: Move __bch2_members_v2_get_mut to sb-members.h 2023-11-05 13:12:17 -05:00
seqmutex.h
siphash.c
siphash.h
six.c bcachefs: six locks: Fix lost wakeup 2023-11-14 23:44:44 -05:00
six.h
snapshot.c bcachefs: Fix an endianness conversion 2023-11-24 02:42:07 -05:00
snapshot.h
str_hash.h
subvolume.c
subvolume.h
subvolume_types.h bcachefs: Use DECLARE_FLEX_ARRAY() helper and fix multiple -Warray-bounds warnings 2023-11-13 21:42:21 -05:00
super-io.c bcachefs: preserve device path as device name 2023-11-24 02:42:07 -05:00
super-io.h
super.c bcachefs: Proper refcounting for journal_keys 2023-11-24 02:43:12 -05:00
super.h
super_types.h bcachefs: preserve device path as device name 2023-11-24 02:42:07 -05:00
sysfs.c Second bcachefs pull request for 6.7-rc1 2023-11-07 11:38:38 -08:00
sysfs.h
tests.c
tests.h
trace.c
trace.h bcachefs: trace_move_extent_start_fail() now includes errcode 2023-11-28 17:18:24 -05:00
two_state_shared_lock.c
two_state_shared_lock.h
util.c bcachefs: bch2_prt_datetime() 2023-11-05 13:12:08 -05:00
util.h bcachefs: bch2_prt_datetime() 2023-11-05 13:12:08 -05:00
varint.c
varint.h
vstructs.h
xattr.c bcachefs: Fix missing locking for dentry->d_parent access 2023-11-16 16:57:19 -05:00
xattr.h