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
This commit is contained in:
parent
3bcd280e3b
commit
abf6a03921
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=271763
@ -653,6 +653,7 @@ get_replication(nvlist_t *nvroot, boolean_t fatal)
|
|||||||
dontreport = 0;
|
dontreport = 0;
|
||||||
vdev_size = -1ULL;
|
vdev_size = -1ULL;
|
||||||
for (c = 0; c < children; c++) {
|
for (c = 0; c < children; c++) {
|
||||||
|
boolean_t is_replacing, is_spare;
|
||||||
nvlist_t *cnv = child[c];
|
nvlist_t *cnv = child[c];
|
||||||
char *path;
|
char *path;
|
||||||
struct stat64 statbuf;
|
struct stat64 statbuf;
|
||||||
@ -669,16 +670,19 @@ get_replication(nvlist_t *nvroot, boolean_t fatal)
|
|||||||
* If this is a replacing or spare vdev, then
|
* If this is a replacing or spare vdev, then
|
||||||
* get the real first child of the vdev.
|
* get the real first child of the vdev.
|
||||||
*/
|
*/
|
||||||
if (strcmp(childtype,
|
is_replacing = strcmp(childtype,
|
||||||
VDEV_TYPE_REPLACING) == 0 ||
|
VDEV_TYPE_REPLACING) == 0;
|
||||||
strcmp(childtype, VDEV_TYPE_SPARE) == 0) {
|
is_spare = strcmp(childtype,
|
||||||
|
VDEV_TYPE_SPARE) == 0;
|
||||||
|
if (is_replacing || is_spare) {
|
||||||
nvlist_t **rchild;
|
nvlist_t **rchild;
|
||||||
uint_t rchildren;
|
uint_t rchildren;
|
||||||
|
|
||||||
verify(nvlist_lookup_nvlist_array(cnv,
|
verify(nvlist_lookup_nvlist_array(cnv,
|
||||||
ZPOOL_CONFIG_CHILDREN, &rchild,
|
ZPOOL_CONFIG_CHILDREN, &rchild,
|
||||||
&rchildren) == 0);
|
&rchildren) == 0);
|
||||||
assert(rchildren == 2);
|
assert((is_replacing && rchildren == 2)
|
||||||
|
|| (is_spare && rchildren >= 2));
|
||||||
cnv = rchild[0];
|
cnv = rchild[0];
|
||||||
|
|
||||||
verify(nvlist_lookup_string(cnv,
|
verify(nvlist_lookup_string(cnv,
|
||||||
|
Loading…
Reference in New Issue
Block a user