diff options
author | Niklas Haas <[email protected]> | 2020-04-21 18:29:31 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2020-04-21 09:29:31 -0700 |
commit | a84c92f93364116b5e7f4685eb6d665526251a51 (patch) | |
tree | e2f447b463db497c881fcb0534538a51db3dc60d | |
parent | 1f043c8be1bf575bae1088f150cf17b35184ad12 (diff) |
Don't attempt trimming "hole" vdevs
On zpools containing hole vdevs (e.g. removed log devices), the `zpool
trim` (and presumably `zpool initialize`) commands will attempt calling
their respective functions on "hole", which fails, as this is not a real
vdev.
Avoid this by removing HOLE vdevs in zpool_collect_leaves.
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: George Melikov <[email protected]>
Signed-off-by: Niklas Haas <[email protected]>
Closes #10227
-rw-r--r-- | cmd/zpool/zpool_main.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c index e8e94cd94..d62a6eb3c 100644 --- a/cmd/zpool/zpool_main.c +++ b/cmd/zpool/zpool_main.c @@ -445,7 +445,8 @@ zpool_collect_leaves(zpool_handle_t *zhp, nvlist_t *nvroot, nvlist_t *res) char *path = zpool_vdev_name(g_zfs, zhp, nvroot, VDEV_NAME_PATH); - if (strcmp(path, VDEV_TYPE_INDIRECT) != 0) + if (strcmp(path, VDEV_TYPE_INDIRECT) != 0 && + strcmp(path, VDEV_TYPE_HOLE) != 0) fnvlist_add_boolean(res, path); free(path); |