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:
``` root@openindiana:~# POOLNAME='testpool' root@openindiana:~# TMPDIR='/var/tmp' root@openindiana:~# sudo zinject -c all removed all registered handlers root@openindiana:~# sudo zpool destroy -f $POOLNAME root@openindiana:~# rm -f $TMPDIR/file-vdev* rm -f $TMPDIR/file-spare* root@openindiana:~# truncate -s 512m $TMPDIR/file-vdev1 root@openindiana:~# truncate -s 512m $TMPDIR/file-vdev2 root@openindiana:~# sudo zpool create -f -O mountpoint=none $POOLNAME mirror $TMPDIR/file-vdev1 $TMPDIR/file-vdev2 root@openindiana:~# truncate -s 512m $TMPDIR/file-spare1 root@openindiana:~# sudo zpool add $POOLNAME spare $TMPDIR/file-spare1 root@openindiana:~# sudo zinject -d $TMPDIR/file-vdev2 -e nxio -T all -f 100 $POOLNAME Added handler 1 with the following properties: pool: testpool vdev: 79ad17dc1b97bcd5 root@openindiana:~# sudo zpool scrub $POOLNAME root@openindiana:~# sleep 1 root@openindiana:~# truncate -s 512m $TMPDIR/file-vdev3 root@openindiana:~# sudo zpool replace $POOLNAME $TMPDIR/file-vdev2 $TMPDIR/file-vdev3 root@openindiana:~# truncate -s 512m $TMPDIR/file-spare2 root@openindiana:~# sudo zpool add $POOLNAME spare $TMPDIR/file-spare2 Assertion failed: nvlist_lookup_string(cnv, "path", &path) == 0, file zpool_vdev.c, line 651 Abort root@openindiana:~# sudo zpool add $POOLNAME $TMPDIR/file-spare2 Assertion failed: nvlist_lookup_string(cnv, "path", &path) == 0, file zpool_vdev.c, line 651 Abort root@openindiana:~# uname -a SunOS openindiana 5.11 master-0-gb3c0a3b184 i86pc i386 i86pc root@openindiana:~# zpool status $POOLNAME pool: testpool state: DEGRADED scan: resilvered 308K in 0h0m with 0 errors on Thu Dec 28 21:46:20 2017 config: NAME STATE READ WRITE CKSUM testpool DEGRADED 0 0 0 mirror-0 DEGRADED 0 0 0 /var/tmp/file-vdev1 ONLINE 0 0 0 spare-1 UNAVAIL 0 0 0 replacing-0 UNAVAIL 0 0 0 /var/tmp/file-vdev2 UNAVAIL 0 0 0 cannot open /var/tmp/file-vdev3 ONLINE 0 0 0 /var/tmp/file-spare1 ONLINE 0 0 0 spares /var/tmp/file-spare1 INUSE currently in use errors: No known data errors root@openindiana:~# ``` Illumos issue: https://www.illumos.org/issues/8941 ZFS on Linux PR: https://github.com/zfsonlinux/zfs/pull/6996 You can view, comment on, or merge this pull request online at: https://github.com/openzfs/openzfs/pull/511 -- Commit Summary -- * 8941 Assertion failed in get_replication() with nested interior VDEVs -- File Changes -- M usr/src/cmd/zpool/zpool_vdev.c (6) M usr/src/pkg/manifests/system-test-zfstest.mf (3) M usr/src/test/zfs-tests/runfiles/delphix.run (3) M usr/src/test/zfs-tests/runfiles/omnios.run (3) M usr/src/test/zfs-tests/runfiles/openindiana.run (3) A usr/src/test/zfs-tests/tests/functional/cli_root/zpool_add/add_nested_replacing_spare.ksh (111) -- Patch Links -- https://github.com/openzfs/openzfs/pull/511.patch https://github.com/openzfs/openzfs/pull/511.diff -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/openzfs/openzfs/pull/511 ------------------------------------------ openzfs-developer Archives: https://openzfs.topicbox.com/groups/developer/discussions/Ta389f57c9b74aa30-M327a2c9d901da122258396ff Powered by Topicbox: https://topicbox.com