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

bcachefs: Fix assert in bch2_backpointer_invalid()



Backpointers that point to invalid devices are caught by fsck, not
.key_invalid; so .key_invalid needs to check for them instead of hitting
asserts.

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 39cd87c4
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -44,6 +44,11 @@ int bch2_backpointer_invalid(struct bch_fs *c, struct bkey_s_c k,
			     struct printbuf *err)
{
	struct bkey_s_c_backpointer bp = bkey_s_c_to_backpointer(k);

	/* these will be caught by fsck */
	if (!bch2_dev_exists2(c, bp.k->p.inode))
		return 0;

	struct bpos bucket = bp_pos_to_bucket(c, bp.k->p);
	int ret = 0;