Skip to content

Commit 4e11162

Browse files
pcd1193182ixhamza
authored andcommitted
Don't try to get mg of hole vdev in removal
Don't try to get mg of hole vdev in removal Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Reviewed-by: Alexander Motin <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Paul Dagnelie <[email protected]> Closes openzfs#17080
1 parent f6ec400 commit 4e11162

File tree

4 files changed

+39
-3
lines changed

4 files changed

+39
-3
lines changed

module/zfs/vdev_removal.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,8 @@ vdev_passivate(vdev_t *vd, uint64_t *txg)
209209
for (uint64_t id = 0; id < rvd->vdev_children; id++) {
210210
vdev_t *cvd = rvd->vdev_child[id];
211211

212-
if (cvd == vd ||
213-
cvd->vdev_ops == &vdev_indirect_ops)
212+
if (cvd == vd || !vdev_is_concrete(cvd) ||
213+
vdev_is_dead(cvd))
214214
continue;
215215

216216
metaslab_class_t *mc = cvd->vdev_mg->mg_class;

tests/runfiles/common.run

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,8 @@ tests = ['removal_all_vdev', 'removal_cancel', 'removal_check_space',
887887
'removal_with_send_recv', 'removal_with_snapshot',
888888
'removal_with_write', 'removal_with_zdb', 'remove_expanded',
889889
'remove_mirror', 'remove_mirror_sanity', 'remove_raidz',
890-
'remove_indirect', 'remove_attach_mirror', 'removal_reservation']
890+
'remove_indirect', 'remove_attach_mirror', 'removal_reservation',
891+
'removal_with_hole']
891892
tags = ['functional', 'removal']
892893

893894
[tests/functional/rename_dirs]

tests/zfs-tests/tests/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,6 +1851,7 @@ nobase_dist_datadir_zfs_tests_tests_SCRIPTS += \
18511851
functional/removal/removal_with_export.ksh \
18521852
functional/removal/removal_with_faulted.ksh \
18531853
functional/removal/removal_with_ganging.ksh \
1854+
functional/removal/removal_with_hole.ksh \
18541855
functional/removal/removal_with_indirect.ksh \
18551856
functional/removal/removal_with_remove.ksh \
18561857
functional/removal/removal_with_scrub.ksh \
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#! /bin/ksh -p
2+
#
3+
# CDDL HEADER START
4+
#
5+
# This file and its contents are supplied under the terms of the
6+
# Common Development and Distribution License ("CDDL"), version 1.0.
7+
# You may only use this file in accordance with the terms of version
8+
# 1.0 of the CDDL.
9+
#
10+
# A full copy of the text of the CDDL should have accompanied this
11+
# source. A copy of the CDDL is also available via the Internet at
12+
# http://www.illumos.org/license/CDDL.
13+
#
14+
# CDDL HEADER END
15+
#
16+
17+
#
18+
# Copyright (c) 2025 by Klara Inc.
19+
#
20+
21+
. $STF_SUITE/include/libtest.shlib
22+
. $STF_SUITE/tests/functional/removal/removal.kshlib
23+
24+
log_onexit default_cleanup_noexit
25+
DISK1="$(echo $DISKS | cut -d' ' -f1)"
26+
DISK2="$(echo $DISKS | cut -d' ' -f2)"
27+
DISK3="$(echo $DISKS | cut -d' ' -f3)"
28+
29+
log_must zpool create $TESTPOOL $DISK1 log $DISK2
30+
log_must zpool add $TESTPOOL $DISK3
31+
log_must zpool remove $TESTPOOL $DISK2
32+
log_must zpool remove $TESTPOOL $DISK1
33+
34+
log_pass "Removal with a hole as the first other device doesn't panic."

0 commit comments

Comments
 (0)