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 
(cherry picked from commit a84c92f)
  • Loading branch information
haasn authored and as-com committed Jun 20, 2020
1 parent 7f5e1ed commit d21360f
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 d21360f

Please sign in to comment.