diff --git a/module/zfs/vdev_removal.c b/module/zfs/vdev_removal.c index 1970c5425..d3351555c 100644 --- a/module/zfs/vdev_removal.c +++ b/module/zfs/vdev_removal.c @@ -209,8 +209,8 @@ vdev_passivate(vdev_t *vd, uint64_t *txg) for (uint64_t id = 0; id < rvd->vdev_children; id++) { vdev_t *cvd = rvd->vdev_child[id]; - if (cvd == vd || - cvd->vdev_ops == &vdev_indirect_ops) + if (cvd == vd || !vdev_is_concrete(cvd) || + vdev_is_dead(cvd)) continue; metaslab_class_t *mc = cvd->vdev_mg->mg_class; diff --git a/tests/runfiles/common.run b/tests/runfiles/common.run index 2ba8a1ca4..8e1ffab5b 100644 --- a/tests/runfiles/common.run +++ b/tests/runfiles/common.run @@ -887,7 +887,8 @@ tests = ['removal_all_vdev', 'removal_cancel', 'removal_check_space', 'removal_with_send_recv', 'removal_with_snapshot', 'removal_with_write', 'removal_with_zdb', 'remove_expanded', 'remove_mirror', 'remove_mirror_sanity', 'remove_raidz', - 'remove_indirect', 'remove_attach_mirror', 'removal_reservation'] + 'remove_indirect', 'remove_attach_mirror', 'removal_reservation', + 'removal_with_hole'] tags = ['functional', 'removal'] [tests/functional/rename_dirs] diff --git a/tests/zfs-tests/tests/Makefile.am b/tests/zfs-tests/tests/Makefile.am index fbb662158..24eeac112 100644 --- a/tests/zfs-tests/tests/Makefile.am +++ b/tests/zfs-tests/tests/Makefile.am @@ -1852,6 +1852,7 @@ nobase_dist_datadir_zfs_tests_tests_SCRIPTS += \ functional/removal/removal_with_export.ksh \ functional/removal/removal_with_faulted.ksh \ functional/removal/removal_with_ganging.ksh \ + functional/removal/removal_with_hole.ksh \ functional/removal/removal_with_indirect.ksh \ functional/removal/removal_with_remove.ksh \ functional/removal/removal_with_scrub.ksh \ diff --git a/tests/zfs-tests/tests/functional/removal/removal_with_hole.ksh b/tests/zfs-tests/tests/functional/removal/removal_with_hole.ksh new file mode 100755 index 000000000..34175fc64 --- /dev/null +++ b/tests/zfs-tests/tests/functional/removal/removal_with_hole.ksh @@ -0,0 +1,34 @@ +#! /bin/ksh -p +# +# CDDL HEADER START +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# +# CDDL HEADER END +# + +# +# Copyright (c) 2025 by Klara Inc. +# + +. $STF_SUITE/include/libtest.shlib +. $STF_SUITE/tests/functional/removal/removal.kshlib + +log_onexit default_cleanup_noexit +DISK1="$(echo $DISKS | cut -d' ' -f1)" +DISK2="$(echo $DISKS | cut -d' ' -f2)" +DISK3="$(echo $DISKS | cut -d' ' -f3)" + +log_must zpool create $TESTPOOL $DISK1 log $DISK2 +log_must zpool add $TESTPOOL $DISK3 +log_must zpool remove $TESTPOOL $DISK2 +log_must zpool remove $TESTPOOL $DISK1 + +log_pass "Removal with a hole as the first other device doesn't panic."