Skip to content

Commit

Permalink
Don't attempt trimming "hole" vdevs
Browse files Browse the repository at this point in the history
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 openzfs#10227
  • Loading branch information
haasn authored and jsai20 committed Mar 30, 2021
1 parent dc2a9a8 commit f8ad2ff
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/zpool/zpool_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f8ad2ff

Please sign in to comment.