Commit 12043cf1 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: fsck: Another transaction restart handling fix

Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 42590b53
...@@ -248,6 +248,8 @@ int bch2_data_update_index_update(struct bch_write_op *op) ...@@ -248,6 +248,8 @@ int bch2_data_update_index_update(struct bch_write_op *op)
} }
continue; continue;
nomatch: nomatch:
trace_data_update_fail(&old.k->p);
if (m->ctxt) { if (m->ctxt) {
BUG_ON(k.k->p.offset <= iter.pos.offset); BUG_ON(k.k->p.offset <= iter.pos.offset);
atomic64_inc(&m->ctxt->stats->keys_raced); atomic64_inc(&m->ctxt->stats->keys_raced);
......
...@@ -728,7 +728,7 @@ static int __get_visible_inodes(struct btree_trans *trans, ...@@ -728,7 +728,7 @@ static int __get_visible_inodes(struct btree_trans *trans,
w->inodes.nr = 0; w->inodes.nr = 0;
for_each_btree_key(trans, iter, BTREE_ID_inodes, POS(0, inum), for_each_btree_key_norestart(trans, iter, BTREE_ID_inodes, POS(0, inum),
BTREE_ITER_ALL_SNAPSHOTS, k, ret) { BTREE_ITER_ALL_SNAPSHOTS, k, ret) {
u32 equiv = bch2_snapshot_equiv(c, k.k->p.snapshot); u32 equiv = bch2_snapshot_equiv(c, k.k->p.snapshot);
...@@ -1372,13 +1372,11 @@ static int check_subdir_count(struct btree_trans *trans, struct inode_walker *w) ...@@ -1372,13 +1372,11 @@ static int check_subdir_count(struct btree_trans *trans, struct inode_walker *w)
} }
} }
fsck_err: fsck_err:
if (ret) { if (ret)
bch_err(c, "error from check_subdir_count(): %s", bch2_err_str(ret)); bch_err(c, "error from check_subdir_count(): %s", bch2_err_str(ret));
if (!ret && trans_was_restarted(trans, restart_count))
ret = -BCH_ERR_transaction_restart_nested;
return ret; return ret;
}
if (trans_was_restarted(trans, restart_count))
return -BCH_ERR_transaction_restart_nested;
return 0;
} }
static int check_dirent_target(struct btree_trans *trans, static int check_dirent_target(struct btree_trans *trans,
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
__entry->dst##_snapshot = (src).snapshot __entry->dst##_snapshot = (src).snapshot
DECLARE_EVENT_CLASS(bpos, DECLARE_EVENT_CLASS(bpos,
TP_PROTO(struct bpos *p), TP_PROTO(const struct bpos *p),
TP_ARGS(p), TP_ARGS(p),
TP_STRUCT__entry( TP_STRUCT__entry(
...@@ -225,7 +225,7 @@ TRACE_EVENT(journal_reclaim_finish, ...@@ -225,7 +225,7 @@ TRACE_EVENT(journal_reclaim_finish,
/* bset.c: */ /* bset.c: */
DEFINE_EVENT(bpos, bkey_pack_pos_fail, DEFINE_EVENT(bpos, bkey_pack_pos_fail,
TP_PROTO(struct bpos *p), TP_PROTO(const struct bpos *p),
TP_ARGS(p) TP_ARGS(p)
); );
...@@ -727,6 +727,13 @@ TRACE_EVENT(copygc_wait, ...@@ -727,6 +727,13 @@ TRACE_EVENT(copygc_wait,
__entry->wait_amount, __entry->until) __entry->wait_amount, __entry->until)
); );
DEFINE_EVENT(bpos, data_update_fail,
TP_PROTO(const struct bpos *p),
TP_ARGS(p)
);
/* btree transactions: */
DECLARE_EVENT_CLASS(transaction_event, DECLARE_EVENT_CLASS(transaction_event,
TP_PROTO(struct btree_trans *trans, TP_PROTO(struct btree_trans *trans,
unsigned long caller_ip), unsigned long caller_ip),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment