bcachefs: Don't invalidate open buckets
authorKent Overstreet <kent.overstreet@linux.dev>
Sat, 18 Feb 2023 01:33:12 +0000 (20:33 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:53 +0000 (17:09 -0400)
Like bch2_trans_mark_bucket(), we shouldn't be incrementing a bucket gen
while it's still open - erasure coding was hitting this.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/alloc_background.c

index aefe72d34c5bb3dfece9b2b1a3cb8fc86f6e1dd8..472466d16b68a8fe293d9045576b7660ad68f9c4 100644 (file)
@@ -1785,6 +1785,9 @@ static int invalidate_one_bucket(struct btree_trans *trans,
                goto err;
        }
 
+       if (bch2_bucket_is_open_safe(c, bucket.inode, bucket.offset))
+               return 0;
+
        a = bch2_trans_start_alloc_update(trans, &alloc_iter, bucket);
        ret = PTR_ERR_OR_ZERO(a);
        if (ret)