Commit c497df8b authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Increment restart count in bch2_trans_begin()

Instead of counting transaction restarts, count when the transaction is
restarted: if bch2_trans_begin() was called when the transaction wasn't
restarted we need to ensure restart_count is still incremented.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
parent 45b033fa
...@@ -3229,6 +3229,7 @@ u32 bch2_trans_begin(struct btree_trans *trans) ...@@ -3229,6 +3229,7 @@ u32 bch2_trans_begin(struct btree_trans *trans)
bch2_trans_reset_updates(trans); bch2_trans_reset_updates(trans);
trans->restart_count++;
trans->mem_top = 0; trans->mem_top = 0;
if (trans->fs_usage_deltas) { if (trans->fs_usage_deltas) {
......
...@@ -218,7 +218,6 @@ static inline int btree_trans_restart_nounlock(struct btree_trans *trans, int er ...@@ -218,7 +218,6 @@ static inline int btree_trans_restart_nounlock(struct btree_trans *trans, int er
BUG_ON(!bch2_err_matches(err, BCH_ERR_transaction_restart)); BUG_ON(!bch2_err_matches(err, BCH_ERR_transaction_restart));
trans->restarted = err; trans->restarted = err;
trans->restart_count++;
return -err; return -err;
} }
......
...@@ -1149,13 +1149,11 @@ static int check_i_sectors(struct btree_trans *trans, struct inode_walker *w) ...@@ -1149,13 +1149,11 @@ static int check_i_sectors(struct btree_trans *trans, struct inode_walker *w)
} }
} }
fsck_err: fsck_err:
if (ret) { if (ret)
bch_err(c, "error from check_i_sectors(): %s", bch2_err_str(ret)); bch_err(c, "error from check_i_sectors(): %s", bch2_err_str(ret));
return ret; if (!ret && trans_was_restarted(trans, restart_count))
} ret = -BCH_ERR_transaction_restart_nested;
if (trans_was_restarted(trans, restart_count)) return ret;
return -BCH_ERR_transaction_restart_nested;
return 0;
} }
static int check_extent(struct btree_trans *trans, struct btree_iter *iter, static int check_extent(struct btree_trans *trans, struct btree_iter *iter,
......
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