svn commit: r329067 - head/cddl/contrib/opensolaris/cmd/zpool
Alan Somers
asomers at FreeBSD.org
Fri Feb 9 16:08:58 UTC 2018
Author: asomers
Date: Fri Feb 9 16:08:57 2018
New Revision: 329067
URL: https://svnweb.freebsd.org/changeset/base/329067
Log:
Fix "zpool add" crash when a replacing vdev has a spare child
Fix an assertion in zpool that causes a crash when running any "zpool add"
command on a spare that contains a replacing vdev with a spare child.
This likely affects Illumos, too.
PR: 225546
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D14138
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 Fri Feb 9 15:58:33 2018 (r329066)
+++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c Fri Feb 9 16:08:57 2018 (r329067)
@@ -688,6 +688,21 @@ get_replication(nvlist_t *nvroot, boolean_t fatal)
verify(nvlist_lookup_string(cnv,
ZPOOL_CONFIG_TYPE,
&childtype) == 0);
+ if (strcmp(childtype,
+ VDEV_TYPE_SPARE) == 0) {
+ /* We have a replacing vdev with
+ * a spare child. Get the first
+ * real child of the spare
+ */
+ verify(
+ nvlist_lookup_nvlist_array(
+ cnv,
+ ZPOOL_CONFIG_CHILDREN,
+ &rchild,
+ &rchildren) == 0);
+ assert(rchildren >= 2);
+ cnv = rchild[0];
+ }
}
verify(nvlist_lookup_string(cnv,
More information about the svn-src-head
mailing list