From 6c287fc7487521efa00ce179cbee4769a201ae47 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Sat, 18 Apr 2020 12:11:18 +0200 Subject: [PATCH] Don't attempt trimming "hole" vdevs On zpools containig 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. Signed-off-by: Niklas Haas --- cmd/zpool/zpool_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c index e8e94cd94ebb..d62a6eb3c9a2 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);