diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-01-01 01:54:13 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:09:21 +0300 |
commit | dfd41fb9f24699393a042f9c34bd46496da1174d (patch) | |
tree | c92bb60a1514fcec6067b65ed9ac0450c3ac4c96 /fs/bcachefs/recovery.h | |
parent | 528b18e6d1c67ccf4ab01cdee94299f3ac61e1ec (diff) | |
download | linux-dfd41fb9f24699393a042f9c34bd46496da1174d.tar.xz |
bcachefs: Fix race between btree updates & journal replay
Add a flag to indicate whether a journal replay key has been
overwritten, and set/test it with appropriate btree locks held.
This fixes a race between the allocator - invalidating buckets, and
doing btree updates - and journal replay, which before this patch could
clobber the allocator thread's update with an older version of the key
from the journal.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/recovery.h')
-rw-r--r-- | fs/bcachefs/recovery.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/bcachefs/recovery.h b/fs/bcachefs/recovery.h index 1504e0bdb940..a7a9496afb95 100644 --- a/fs/bcachefs/recovery.h +++ b/fs/bcachefs/recovery.h @@ -37,6 +37,8 @@ int bch2_journal_key_insert(struct bch_fs *, enum btree_id, unsigned, struct bkey_i *); int bch2_journal_key_delete(struct bch_fs *, enum btree_id, unsigned, struct bpos); +void bch2_journal_key_overwritten(struct bch_fs *, enum btree_id, + unsigned, struct bpos); void bch2_btree_and_journal_iter_advance(struct btree_and_journal_iter *); struct bkey_s_c bch2_btree_and_journal_iter_peek(struct btree_and_journal_iter *); |