bcachefs: bch2_btree_delete_range_trans() now returns -BCH_ERR_transaction_restart_nested
authorKent Overstreet <kent.overstreet@gmail.com>
Thu, 18 Aug 2022 17:00:26 +0000 (13:00 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:38 +0000 (17:09 -0400)
commit42590b53fef427f96fc50da4974923564e9033cd
tree17a9b25e2bec65c4d0b150708d498d73cce1b249
parentefd0d03816dd0d5127217220f85f1f0e621974d1
bcachefs: bch2_btree_delete_range_trans() now returns -BCH_ERR_transaction_restart_nested

The new convention is that functions that handle transaction restarts
within an existing transaction context should return
-BCH_ERR_transaction_restart_nested when they did so, since they
invalidated the outer transaction context.

This also means bch2_btree_delete_range_trans() is changed to only call
bch2_trans_begin() after a transaction restart, not on every loop
iteration.

This is to fix a bug in fsck, in check_inode() when we truncate an inode
with BCH_INODE_I_SIZE_DIRTY set.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
fs/bcachefs/btree_update_leaf.c
fs/bcachefs/fsck.c