bcachefs: Fix btree path sorting

In btree_update_interior.c, we were changing a path's level directly -
which affects path sort order - without re-sorting paths, leading to
assertions when bch2_path_get() verified paths were sorted correctly.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
Kent Overstreet 2022-02-25 22:33:01 -05:00 committed by Kent Overstreet
parent cb59811183
commit a0a07c59f5
2 changed files with 4 additions and 1 deletions

View file

@ -1797,11 +1797,12 @@ void bch2_dump_trans_paths_updates(struct btree_trans *trans)
bch2_bpos_to_text(&buf1, path->pos);
printk(KERN_ERR "path: idx %u ref %u:%u%s%s btree %s pos %s locks %u %pS\n",
printk(KERN_ERR "path: idx %u ref %u:%u%s%s btree=%s l=%u pos %s locks %u %pS\n",
path->idx, path->ref, path->intent_ref,
path->should_be_locked ? " S" : "",
path->preserve ? " P" : "",
bch2_btree_ids[path->btree_id],
path->level,
buf1.buf,
path->nodes_locked,
#ifdef CONFIG_BCACHEFS_DEBUG

View file

@ -1918,6 +1918,8 @@ static int __bch2_btree_node_update_key(struct btree_trans *trans,
path_l(iter2.path)->b = BTREE_ITER_NO_NODE_UP;
iter2.path->level++;
trans->paths_sorted = false;
ret = bch2_btree_iter_traverse(&iter2) ?:
bch2_trans_update(trans, &iter2, new_key, BTREE_TRIGGER_NORUN);
if (ret)