Skip to content

libzfs: improve error message for zpool create with ENXIO#18184

Merged
behlendorf merged 1 commit intoopenzfs:masterfrom
chrislongros:fix/zpool-create-error-message
Feb 10, 2026
Merged

libzfs: improve error message for zpool create with ENXIO#18184
behlendorf merged 1 commit intoopenzfs:masterfrom
chrislongros:fix/zpool-create-error-message

Conversation

@chrislongros
Copy link
Copy Markdown
Contributor

@chrislongros chrislongros commented Feb 7, 2026

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.

A companion kernel-side fix to return ZFS_ERR_ASHIFT_MISMATCH from spa_create() (matching the existing pattern in spa_vdev_add and spa_vdev_attach) is in progress as a separate PR.

Closes #11087

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.

Closes openzfs#11087

Signed-off-by: Christos Longros <[email protected]>
Copy link
Copy Markdown
Contributor

@behlendorf behlendorf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Not for this PR, but if you'd like to improve things further another common source of frustration is nothing tells the user which device is causing the problem. One reasonable way to handle this would be to update the user code to pass an nvlist stored in zc_nvlist_dst to kernel which it can populate with more detailed error information.

zpool_import_props() already does something similar today by reporting additional pool import information in the ZPOOL_CONFIG_LOAD_INFO nvlist. Adding a ZPOOL_CONFIG_CREATE_INFO would fit in that with model, it would just need to be treated as additional optional information when available.

@behlendorf behlendorf added Status: Code Review Needed Ready for review and testing Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Feb 9, 2026
@behlendorf behlendorf merged commit 040ba7a into openzfs:master Feb 10, 2026
26 checks passed
@chrislongros chrislongros deleted the fix/zpool-create-error-message branch March 14, 2026 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Accepted Ready to integrate (reviewed, tested)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong error message for zpool create

2 participants