vdev_geom: converted injected EIO errors to ENXIO

By the assertion, vdev_geom_io_done() only expects ENXIO on an error
when the geom is a top-level (allocating) vdev[1][2]. However, zinject
currently can't insert ENXIO directly, possibly because on Solaris
outright disk failures were reported with EIO[2][3].

This is a narrow workaround to convert EIO to ENXIO when injections are
enabled, to avoid the assertion and allow the test suite to test
behaviour related to probe failure on FreeBSD.

1. freebsd/freebsd-src@37ec52ca7a
2. freebsd/freebsd-src@cd730bd6b2
3. illumos/illumos-gate@ea8dc4b6d2

Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Paul Dagnelie <paul.dagnelie@klarasystems.com>
Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
Closes #17355
This commit is contained in:
Rob Norris 2025-05-16 15:25:59 +10:00 committed by Brian Behlendorf
parent 2303775fea
commit 0372def8c9

View File

@ -1241,6 +1241,15 @@ vdev_geom_io_done(zio_t *zio)
}
if (bp == NULL) {
if (zio_injection_enabled && zio->io_error == EIO)
/*
* Convert an injected EIO to ENXIO. This is needed to
* work around zio_handle_device_injection_impl() not
* currently being able to inject ENXIO directly, while
* the assertion below only allows ENXIO here.
*/
zio->io_error = SET_ERROR(ENXIO);
else
ASSERT3S(zio->io_error, ==, ENXIO);
return;
}