From 0372def8c9b013f98b6e0bb58f5c82bfd616ec02 Mon Sep 17 00:00:00 2001 From: Rob Norris Date: Fri, 16 May 2025 15:25:59 +1000 Subject: [PATCH] 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@37ec52ca7a2a 2. freebsd/freebsd-src@cd730bd6b2b1 3. illumos/illumos-gate@ea8dc4b6d2 Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Reviewed-by: Brian Behlendorf Reviewed-by: Alexander Motin Reviewed-by: Paul Dagnelie Signed-off-by: Rob Norris Closes #17355 --- module/os/freebsd/zfs/vdev_geom.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/module/os/freebsd/zfs/vdev_geom.c b/module/os/freebsd/zfs/vdev_geom.c index b75d1ccea..c8ab7cc7c 100644 --- a/module/os/freebsd/zfs/vdev_geom.c +++ b/module/os/freebsd/zfs/vdev_geom.c @@ -1241,7 +1241,16 @@ vdev_geom_io_done(zio_t *zio) } if (bp == NULL) { - ASSERT3S(zio->io_error, ==, ENXIO); + 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; }