libzfs: handle EDOM error in zpool_create

When creating a pool with devices that have incompatible block sizes,
the kernel returns EDOM. However, zpool_create() did not handle this
errno, falling through to zpool_standard_error() which produced a
confusing message about invalid property values.

Add a case EDOM handler in zpool_create() to return EZFS_BADDEV with
a descriptive auxiliary message, consistent with the existing EDOM
handler in zpool_vdev_add().

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Christos Longros <chris.longros@gmail.com>
Closes #18268
This commit is contained in:
Christos Longros
2026-03-08 20:59:10 +01:00
committed by GitHub
parent c5905b2cb7
commit 304de7f19b
5 changed files with 76 additions and 2 deletions
+5
View File
@@ -1696,6 +1696,11 @@ zpool_create(libzfs_handle_t *hdl, const char *pool, nvlist_t *nvroot,
"one or more devices could not be opened"));
return (zfs_error(hdl, EZFS_BADDEV, errbuf));
case EDOM:
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"block size out of range or does not match"));
return (zfs_error(hdl, EZFS_BADDEV, errbuf));
default:
return (zpool_standard_error(hdl, errno, errbuf));
}