mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 03:09:34 +03:00
Add explicit error for device_rebuild being disabled
Currently, you get back "can only attach to mirrors and top-level disks" unconditionally if zpool attach returns ENOTSUP, but that also happens if, say, feature@device_rebuild=disabled and you tried attach -s. So let's print an error for that case, lest people go down a rabbit hole looking into what they did wrong. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Rich Ercolani <rincebrain@gmail.com> Closes #11414 Closes #12680
This commit is contained in:
parent
4476ccd906
commit
1139e170d4
@ -3364,9 +3364,20 @@ zpool_vdev_attach(zpool_handle_t *zhp, const char *old_disk,
|
||||
"cannot replace a replacing device"));
|
||||
}
|
||||
} else {
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"can only attach to mirrors and top-level "
|
||||
"disks"));
|
||||
char status[64] = {0};
|
||||
zpool_prop_get_feature(zhp,
|
||||
"feature@device_rebuild", status, 63);
|
||||
if (rebuild &&
|
||||
strncmp(status, ZFS_FEATURE_DISABLED, 64) == 0) {
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"device_rebuild feature must be enabled "
|
||||
"in order to use sequential "
|
||||
"reconstruction"));
|
||||
} else {
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"can only attach to mirrors and top-level "
|
||||
"disks"));
|
||||
}
|
||||
}
|
||||
(void) zfs_error(hdl, EZFS_BADTARGET, msg);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user