libzfs: improve error message for zpool create with ENXIO

When zpool create fails because a vdev cannot be opened (ENXIO),
the error falls through to zpool_standard_error() which reports
the generic 'one or more devices is currently unavailable'. This
is misleading when the real cause is a block size mismatch or
other device open failure.

Add an explicit ENXIO case in zpool_create()'s error handling to
provide a more descriptive message.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Christos Longros <chris.longros@gmail.com>
Closes #18184
Closes #11087
This commit is contained in:
Christos Longros 2026-02-10 22:19:44 +01:00 committed by GitHub
parent e601a1fb77
commit 040ba7a7ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1632,6 +1632,11 @@ zpool_create(libzfs_handle_t *hdl, const char *pool, nvlist_t *nvroot,
errbuf));
}
case ENXIO:
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"one or more devices could not be opened"));
return (zfs_error(hdl, EZFS_BADDEV, errbuf));
default:
return (zpool_standard_error(hdl, errno, errbuf));
}