diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-10-29 18:21:05 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:15 -0400 |
commit | 37f72492f401671f1f773cc62dddf742e7fc553b (patch) | |
tree | 49572cf75962f9943856e6d7a90f0d27980dc98e /fs/bcachefs/buckets.c | |
parent | fae1157d184084f1716a10273423f8e949d8471f (diff) | |
download | lwn-37f72492f401671f1f773cc62dddf742e7fc553b.tar.gz lwn-37f72492f401671f1f773cc62dddf742e7fc553b.zip |
bcachefs: Fix bch2_mark_update()
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>
Diffstat (limited to 'fs/bcachefs/buckets.c')
-rw-r--r-- | fs/bcachefs/buckets.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c index fc4d9d75794c..48687a70411e 100644 --- a/fs/bcachefs/buckets.c +++ b/fs/bcachefs/buckets.c @@ -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; |