fix a regression in r320452, ZFS ABD import

I overlooked the fact that vdev_op_io_done hook is called even if the
actual I/O is skipped, for example, in the case of a missing vdev.
Arguably, this could be considered an issue in the zio pipeline engine,
but for now I am adding defensive code to check for io_bp being NULL
along with assertions that that happens only when it can be really
expected.

PR:		220691
Reported by:	peter, cy
Tested by:	cy
MFC after:	1 week
X-MFC with:	r320156, r320452
This commit is contained in:
avg 2017-07-18 07:41:38 +00:00
parent 609a66450f
commit c2f37ae9bc

View File

@ -1090,6 +1090,14 @@ vdev_geom_io_done(zio_t *zio)
{
struct bio *bp = zio->io_bio;
if (bp == NULL) {
ASSERT3S(zio->io_error, !=, 0);
IMPLY(zio->io_type == ZIO_TYPE_READ ||
zio->io_type == ZIO_TYPE_WRITE,
zio->io_error == ENXIO);
return;
}
if (zio->io_type == ZIO_TYPE_READ) {
abd_return_buf_copy(zio->io_abd, bp->bio_data, zio->io_size);
} else if (zio->io_type == ZIO_TYPE_WRITE) {