Commit eca5b56c authored by Kent Overstreet's avatar Kent Overstreet
Browse files

bcachefs: Don't generate alloc updates to invalid buckets

parent e7f1a528
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -604,6 +604,13 @@ static int bch2_trigger_pointer(struct btree_trans *trans,
	}

	struct bpos bucket = PTR_BUCKET_POS(ca, &p.ptr);
	if (!bucket_valid(ca, bucket.offset)) {
		if (insert) {
			bch2_dev_bucket_missing(ca, bucket.offset);
			ret = -BCH_ERR_trigger_pointer;
		}
		goto err;
	}

	if (flags & BTREE_TRIGGER_transactional) {
		struct bkey_i_alloc_v4 *a = bch2_trans_start_alloc_update(trans, bucket, 0);