From owner-svn-src-vendor@freebsd.org Thu Feb 22 01:17:32 2018 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1ACBF148B4; Thu, 22 Feb 2018 01:17:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 74FA37E4C7; Thu, 22 Feb 2018 01:17:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6FD80204C6; Thu, 22 Feb 2018 01:17:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M1HWei033010; Thu, 22 Feb 2018 01:17:32 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M1HWb1033009; Thu, 22 Feb 2018 01:17:32 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802220117.w1M1HWb1033009@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Feb 2018 01:17:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329778 - vendor/illumos/dist/cmd/zpool X-SVN-Group: vendor X-SVN-Commit-Author: mav X-SVN-Commit-Paths: vendor/illumos/dist/cmd/zpool X-SVN-Commit-Revision: 329778 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 01:17:32 -0000 Author: mav Date: Thu Feb 22 01:17:32 2018 New Revision: 329778 URL: https://svnweb.freebsd.org/changeset/base/329778 Log: 8941 zpool add: assertion failed in get_replication() with nested interior VDEVs illumos/illumos-gate@ac0215f4d618163d117a40fbf77a3f944852cb7b When replacing a faulted device which was previously handled by a spare multiple levels of nested interior VDEVs will be present in the pool configuration: get_replication() needs to handle this situation gracefully to let zpool add new devices to the pool Reviewed by: Matthew Ahrens Reviewed by: Andrew Stormont Approved by: Dan McDonald Author: loli10K Modified: vendor/illumos/dist/cmd/zpool/zpool_vdev.c Modified: vendor/illumos/dist/cmd/zpool/zpool_vdev.c ============================================================================== --- vendor/illumos/dist/cmd/zpool/zpool_vdev.c Thu Feb 22 01:00:46 2018 (r329777) +++ vendor/illumos/dist/cmd/zpool/zpool_vdev.c Thu Feb 22 01:17:32 2018 (r329778) @@ -628,9 +628,11 @@ get_replication(nvlist_t *nvroot, boolean_t fatal) /* * 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: do this + * in a loop because replacing and spare vdevs + * can be nested. */ - if (strcmp(childtype, + while (strcmp(childtype, VDEV_TYPE_REPLACING) == 0 || strcmp(childtype, VDEV_TYPE_SPARE) == 0) { nvlist_t **rchild;