summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Somers <asomers@gmail.com>2017-09-12 09:27:38 -0600
committerPrakash Surya <prakash.surya@delphix.com>2018-01-18 09:07:03 -0800
commit2ba5f978a4f9b02da9db1b8cdd9ea5498eb00ad9 (patch)
treeb2e78f426d681f37db22b4001c5d07901033a342
parent620632424515d984b96f0a398e2d0cba9412182c (diff)
downloadillumos-joyent-2ba5f978a4f9b02da9db1b8cdd9ea5498eb00ad9.tar.gz
8641 "zpool clear" and "zinject" don't work on "spare" or "replacing" vdevs
Reviewed by: Matthew Ahrens <mahrens@delphix.com> Approved by: Gordon Ross <gwr@nexenta.com>
-rw-r--r--usr/src/lib/libzfs/common/libzfs_pool.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/usr/src/lib/libzfs/common/libzfs_pool.c b/usr/src/lib/libzfs/common/libzfs_pool.c
index 78c21fc49d..ec9fd723d5 100644
--- a/usr/src/lib/libzfs/common/libzfs_pool.c
+++ b/usr/src/lib/libzfs/common/libzfs_pool.c
@@ -50,6 +50,7 @@
#include "zfeature_common.h"
static int read_efi_label(nvlist_t *, diskaddr_t *, boolean_t *);
+static boolean_t zpool_vdev_is_interior(const char *name);
#define BACKUP_SLICE "s2"
@@ -2079,10 +2080,7 @@ vdev_to_nvlist_iter(nvlist_t *nv, nvlist_t *search, boolean_t *avail_spare,
break;
}
- verify(strncmp(type, VDEV_TYPE_RAIDZ,
- strlen(VDEV_TYPE_RAIDZ)) == 0 ||
- strncmp(type, VDEV_TYPE_MIRROR,
- strlen(VDEV_TYPE_MIRROR)) == 0);
+ verify(zpool_vdev_is_interior(type));
verify(nvlist_lookup_uint64(nv, ZPOOL_CONFIG_ID,
&id) == 0);
@@ -2189,10 +2187,13 @@ zpool_find_vdev_by_physpath(zpool_handle_t *zhp, const char *ppath,
/*
* Determine if we have an "interior" top-level vdev (i.e mirror/raidz).
*/
-boolean_t
+static boolean_t
zpool_vdev_is_interior(const char *name)
{
if (strncmp(name, VDEV_TYPE_RAIDZ, strlen(VDEV_TYPE_RAIDZ)) == 0 ||
+ strncmp(name, VDEV_TYPE_SPARE, strlen(VDEV_TYPE_SPARE)) == 0 ||
+ strncmp(name,
+ VDEV_TYPE_REPLACING, strlen(VDEV_TYPE_REPLACING)) == 0 ||
strncmp(name, VDEV_TYPE_MIRROR, strlen(VDEV_TYPE_MIRROR)) == 0)
return (B_TRUE);
return (B_FALSE);