Ilya,
I think there is a bigger problem here that your vdev_mirror() change
would cover up. The problems is that we should never have a bp with a
dva that is out of range. So we need to understand how that is occurring.
As for you question about metaslab_allocate_dva(), I'm assuming you're
I am looking at a rare but nasty case of corruption in which a block
pointer has one of ditto dva's out of range.
This causes vdev_lookup_top() to return NULL for a vdev pointer.
Going through the callers of vdev_lookup_top(), I noticed that in some
cases NULL vdev are handled properly, while in