bcachefs: Fix "trying to move an extent, but nr_replicas=0"
authorKent Overstreet <kent.overstreet@linux.dev>
Sun, 18 Aug 2024 17:13:39 +0000 (13:13 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Thu, 22 Aug 2024 06:07:22 +0000 (02:07 -0400)
commit8cc0e50614520c6c609c6ae32a65d0591b7865a1
tree542938c25ea5d9005318d037c6d6d4b042026607
parent3f53d050416e88122d53aabbadb1fede998004da
bcachefs: Fix "trying to move an extent, but nr_replicas=0"

data_update_init() does a bunch of complicated stuff to decide how many
replicas to add, since we only want to increase an extent's durability
on an explicit rereplicate, but extent pointers may be on devices with
different durability settings.

There was a corner case when evacuating a device that had been set to
durability=0 after data had been written to it, and extents on that
device had already been rereplicated - then evacuate only needs to drop
pointers on that device, not move them.

So the assert for !m->op.nr_replicas was spurious; this was a perfectly
legitimate case that needed to be handled.

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