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: Kent Overstreet <kent.overstreet@gmail.com>
bch2_trans_reset_updates(trans);
+ trans->restart_count++;
trans->mem_top = 0;
if (trans->fs_usage_deltas) {
BUG_ON(!bch2_err_matches(err, BCH_ERR_transaction_restart));
trans->restarted = err;
- trans->restart_count++;
return -err;
}
}
}
fsck_err:
- if (ret) {
+ if (ret)
bch_err(c, "error from check_i_sectors(): %s", bch2_err_str(ret));
- return ret;
- }
- if (trans_was_restarted(trans, restart_count))
- return -BCH_ERR_transaction_restart_nested;
- return 0;
+ if (!ret && trans_was_restarted(trans, restart_count))
+ ret = -BCH_ERR_transaction_restart_nested;
+ return ret;
}
static int check_extent(struct btree_trans *trans, struct btree_iter *iter,