svn commit: r271763 - head/cddl/contrib/opensolaris/cmd/zpool
Will Andrews
will at FreeBSD.org
Thu Sep 18 14:02:26 UTC 2014
Author: will
Date: Thu Sep 18 14:02:25 2014
New Revision: 271763
URL: http://svnweb.freebsd.org/changeset/base/271763
Log:
Fix an assert to tolerate spare parents with more than 2 children.
This can occur if a spare is being spared, which would yield three
children: the original pool drive, the previous spare, and the spare
that is replacing it.
MFC after: 1 week
Sponsored by: Spectra Logic
Affects: All ZFS versions starting 7 Jun 2006 (illumos 94de1d4c)
MFSpectraBSD: r668345 on 2013/06/04 17:10:43
Modified:
head/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c
Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c
==============================================================================
--- head/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c Thu Sep 18 13:59:36 2014 (r271762)
+++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c Thu Sep 18 14:02:25 2014 (r271763)
@@ -653,6 +653,7 @@ get_replication(nvlist_t *nvroot, boolea
dontreport = 0;
vdev_size = -1ULL;
for (c = 0; c < children; c++) {
+ boolean_t is_replacing, is_spare;
nvlist_t *cnv = child[c];
char *path;
struct stat64 statbuf;
@@ -669,16 +670,19 @@ get_replication(nvlist_t *nvroot, boolea
* If this is a replacing or spare vdev, then
* get the real first child of the vdev.
*/
- if (strcmp(childtype,
- VDEV_TYPE_REPLACING) == 0 ||
- strcmp(childtype, VDEV_TYPE_SPARE) == 0) {
+ is_replacing = strcmp(childtype,
+ VDEV_TYPE_REPLACING) == 0;
+ is_spare = strcmp(childtype,
+ VDEV_TYPE_SPARE) == 0;
+ if (is_replacing || is_spare) {
nvlist_t **rchild;
uint_t rchildren;
verify(nvlist_lookup_nvlist_array(cnv,
ZPOOL_CONFIG_CHILDREN, &rchild,
&rchildren) == 0);
- assert(rchildren == 2);
+ assert((is_replacing && rchildren == 2)
+ || (is_spare && rchildren >= 2));
cnv = rchild[0];
verify(nvlist_lookup_string(cnv,
More information about the svn-src-all
mailing list