bcachefs: Fix for bch2_trans_commit() unlocking when it's not supposed to
When we pass BTREE_INSERT_NOUNLOCK bch2_trans_commit isn't supposed to unlock after a successful commit, but it was calling bch2_trans_cond_resched() - oops. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
3bf57160c2
commit
f793fd85dc
@ -2155,7 +2155,8 @@ void bch2_trans_reset(struct btree_trans *trans, unsigned flags)
|
||||
(void *) &trans->fs_usage_deltas->memset_start);
|
||||
}
|
||||
|
||||
bch2_trans_cond_resched(trans);
|
||||
if (!(flags & TRANS_RESET_NOUNLOCK))
|
||||
bch2_trans_cond_resched(trans);
|
||||
|
||||
if (!(flags & TRANS_RESET_NOTRAVERSE))
|
||||
bch2_btree_iter_traverse_all(trans);
|
||||
|
@ -303,6 +303,7 @@ static inline void set_btree_iter_dontneed(struct btree_trans *trans, struct btr
|
||||
}
|
||||
|
||||
#define TRANS_RESET_NOTRAVERSE (1 << 0)
|
||||
#define TRANS_RESET_NOUNLOCK (1 << 1)
|
||||
|
||||
void bch2_trans_reset(struct btree_trans *, unsigned);
|
||||
|
||||
|
@ -826,7 +826,7 @@ int __bch2_trans_commit(struct btree_trans *trans)
|
||||
struct btree_insert_entry *i = NULL;
|
||||
struct btree_iter *iter;
|
||||
bool trans_trigger_run;
|
||||
unsigned u64s;
|
||||
unsigned u64s, reset_flags = 0;
|
||||
int ret = 0;
|
||||
|
||||
if (!trans->nr_updates)
|
||||
@ -940,7 +940,11 @@ out:
|
||||
if (likely(!(trans->flags & BTREE_INSERT_NOCHECK_RW)))
|
||||
percpu_ref_put(&trans->c->writes);
|
||||
out_reset:
|
||||
bch2_trans_reset(trans, !ret ? TRANS_RESET_NOTRAVERSE : 0);
|
||||
if (!ret)
|
||||
reset_flags |= TRANS_RESET_NOTRAVERSE;
|
||||
if (!ret && (trans->flags & BTREE_INSERT_NOUNLOCK))
|
||||
reset_flags |= TRANS_RESET_NOUNLOCK;
|
||||
bch2_trans_reset(trans, reset_flags);
|
||||
|
||||
return ret;
|
||||
err:
|
||||
|
Loading…
x
Reference in New Issue
Block a user