Skip to content
This repository has been archived by the owner on Nov 7, 2019. It is now read-only.

Commit

Permalink
8641 "zpool clear" and "zinject" don't work on "spare" or "replacing"…
Browse files Browse the repository at this point in the history
… vdevs

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Gordon Ross <gwr@nexenta.com>
  • Loading branch information
asomers authored and Prakash Surya committed Jan 18, 2018
1 parent 6206324 commit 2ba5f97
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions usr/src/lib/libzfs/common/libzfs_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 2ba5f97

Please sign in to comment.