mirror of
https://github.com/torvalds/linux.git
synced 2024-12-29 06:12:08 +00:00
bcachefs: Ensure iterators are valid before calling trans_mark_key()
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
b2ca9903cd
commit
0abb250125
@ -706,6 +706,15 @@ int __bch2_trans_commit(struct btree_trans *trans)
|
||||
trans_trigger_run = false;
|
||||
|
||||
trans_for_each_update(trans, i) {
|
||||
/* we know trans->nounlock won't be set here: */
|
||||
if (unlikely(!(i->iter->locks_want < 1
|
||||
? __bch2_btree_iter_upgrade(i->iter, 1)
|
||||
: i->iter->uptodate <= BTREE_ITER_NEED_PEEK))) {
|
||||
trace_trans_restart_upgrade(trans->ip);
|
||||
ret = -EINTR;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (iter_has_trans_triggers(i->iter) &&
|
||||
!i->trans_triggers_run) {
|
||||
i->trans_triggers_run = true;
|
||||
@ -723,15 +732,6 @@ int __bch2_trans_commit(struct btree_trans *trans)
|
||||
} while (trans_trigger_run);
|
||||
|
||||
trans_for_each_update(trans, i) {
|
||||
/* we know trans->nounlock won't be set here: */
|
||||
if (unlikely(!(i->iter->locks_want < 1
|
||||
? __bch2_btree_iter_upgrade(i->iter, 1)
|
||||
: i->iter->uptodate <= BTREE_ITER_NEED_PEEK))) {
|
||||
trace_trans_restart_upgrade(trans->ip);
|
||||
ret = -EINTR;
|
||||
goto out;
|
||||
}
|
||||
|
||||
u64s = jset_u64s(i->k->k.u64s);
|
||||
if (0)
|
||||
trans->journal_preres_u64s += u64s;
|
||||
|
Loading…
Reference in New Issue
Block a user