]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bcachefs: Fix bch2_mark_update()
authorKent Overstreet <kent.overstreet@gmail.com>
Fri, 29 Oct 2021 22:21:05 +0000 (18:21 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:15 +0000 (17:09 -0400)
When the old or new key doesn't exist, we should still pass in a deleted
key with the correct pos. This fixes a bug in the ec code, when
bch2_mark_stripe() was looking up the wrong in-memory stripe.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
fs/bcachefs/buckets.c

index fc4d9d75794cdb1f5cd4e19b7ff4b5f1ed424bb2..48687a70411e1d5128752e8bc8a6844e4c6a624c 100644 (file)
@@ -1231,6 +1231,8 @@ int bch2_mark_key(struct bch_fs *c, struct bkey_s_c new, unsigned flags)
        struct bkey_s_c old = (struct bkey_s_c) { &deleted, NULL };
        int ret;
 
+       deleted.p = new.k->p;
+
        percpu_down_read(&c->mark_lock);
        ret = bch2_mark_key_locked(c, old, new, 0, flags);
        percpu_up_read(&c->mark_lock);
@@ -1248,6 +1250,8 @@ int bch2_mark_update(struct btree_trans *trans, struct btree_path *path,
        struct bkey             unpacked;
        int ret;
 
+       _deleted.p = path->pos;
+
        if (unlikely(flags & BTREE_TRIGGER_NORUN))
                return 0;
 
@@ -1846,6 +1850,8 @@ int bch2_trans_mark_update(struct btree_trans *trans,
        struct bkey             unpacked;
        int ret;
 
+       _deleted.p = path->pos;
+
        if (unlikely(flags & BTREE_TRIGGER_NORUN))
                return 0;