summaryrefslogtreecommitdiff
path: root/fs/bcachefs/snapshot.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-09-10 23:24:02 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:10:12 +0300
commitc872afa22420cbbeb8c78656926928b9e2abae18 (patch)
tree4639e173bb895c6c377c50757cd45dfbfe702903 /fs/bcachefs/snapshot.c
parent5b7fbdcd5b04b618178d6339e36435997ef6b086 (diff)
downloadlinux-c872afa22420cbbeb8c78656926928b9e2abae18.tar.xz
bcachefs: Fix bch2_propagate_key_to_snapshot_leaves()
When we handle a transaction restart in a nested context, we need to return -BCH_ERR_transaction_restart_nested because we invalidated the outer context's iterators and locks. bch2_propagate_key_to_snapshot_leaves() wasn't doing this, this patch fixes it to use trans_was_restarted(). Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/snapshot.c')
-rw-r--r--fs/bcachefs/snapshot.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/bcachefs/snapshot.c b/fs/bcachefs/snapshot.c
index 9da09911466e..3ca61ede28d5 100644
--- a/fs/bcachefs/snapshot.c
+++ b/fs/bcachefs/snapshot.c
@@ -1637,6 +1637,7 @@ int bch2_propagate_key_to_snapshot_leaves(struct btree_trans *trans,
{
struct bch_fs *c = trans->c;
struct bkey_buf sk;
+ u32 restart_count = trans->restart_count;
int ret;
bch2_bkey_buf_init(&sk);
@@ -1659,7 +1660,8 @@ int bch2_propagate_key_to_snapshot_leaves(struct btree_trans *trans,
}
bch2_bkey_buf_exit(&sk, c);
- return ret;
+
+ return ret ?: trans_was_restarted(trans, restart_count);
}
int bch2_snapshots_read(struct bch_fs *c)