Skip to content

Commit b8a581b

Browse files
author
Paul Dagnelie
committed
Add test for more than nparity sitouts
Signed-off-by: Paul Dagnelie <[email protected]>
1 parent 83597af commit b8a581b

File tree

4 files changed

+114
-2
lines changed

4 files changed

+114
-2
lines changed

module/zfs/vdev_raidz.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2998,7 +2998,7 @@ vdev_child_slow_outlier(zio_t *zio)
29982998
boolean_t sitting = vdev_sit_out_reads(cvd, 0) ||
29992999
cvd->vdev_state != VDEV_STATE_HEALTHY;
30003000

3001-
if (sitting && sitouts++ >= vdev_get_nparity(vd)) {
3001+
if (sitting && ++sitouts >= vdev_get_nparity(vd)) {
30023002
/*
30033003
* We can't sit out more disks than we have
30043004
* parity

tests/runfiles/linux.run

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ tags = ['functional', 'direct']
110110
tests = ['events_001_pos', 'events_002_pos', 'zed_rc_filter', 'zed_fd_spill',
111111
'zed_cksum_reported', 'zed_cksum_config', 'zed_io_config',
112112
'zed_slow_io', 'zed_slow_io_many_vdevs', 'zed_diagnose_multiple',
113-
'slow_vdev_sit_out', 'slow_vdev_degraded_sit_out']
113+
'slow_vdev_sit_out', 'slow_vdev_sit_out_neg', 'slow_vdev_degraded_sit_out']
114114
tags = ['functional', 'events']
115115

116116
[tests/functional/fallocate:Linux]

tests/zfs-tests/tests/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1525,6 +1525,7 @@ nobase_dist_datadir_zfs_tests_tests_SCRIPTS += \
15251525
functional/events/setup.ksh \
15261526
functional/events/slow_vdev_degraded_sit_out.ksh \
15271527
functional/events/slow_vdev_sit_out.ksh \
1528+
functional/events/slow_vdev_sit_out_neg.ksh \
15281529
functional/events/zed_cksum_config.ksh \
15291530
functional/events/zed_cksum_reported.ksh \
15301531
functional/events/zed_diagnose_multiple.ksh \
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
#!/bin/ksh -p
2+
# SPDX-License-Identifier: CDDL-1.0
3+
#
4+
# CDDL HEADER START
5+
#
6+
# The contents of this file are subject to the terms of the
7+
# Common Development and Distribution License (the "License").
8+
# You may not use this file except in compliance with the License.
9+
#
10+
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11+
# or https://opensource.org/licenses/CDDL-1.0.
12+
# See the License for the specific language governing permissions
13+
# and limitations under the License.
14+
#
15+
# When distributing Covered Code, include this CDDL HEADER in each
16+
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17+
# If applicable, add the following below this CDDL HEADER, with the
18+
# fields enclosed by brackets "[]" replaced with your own identifying
19+
# information: Portions Copyright [yyyy] [name of copyright owner]
20+
#
21+
# CDDL HEADER END
22+
#
23+
24+
# Copyright (c) 2024 by Lawrence Livermore National Security, LLC.
25+
# Copyright (c) 2025 by Klara, Inc.
26+
27+
# DESCRIPTION:
28+
# Verify that we don't sit out too many vdevs
29+
#
30+
# STRATEGY:
31+
# 1. Create various draid2 pool
32+
# 2. Inject delays into three of the disks
33+
# 3. Do reads to trigger sit-outs
34+
# 4. Verify exactly 2 disks sit out
35+
#
36+
37+
. $STF_SUITE/include/libtest.shlib
38+
39+
function cleanup
40+
{
41+
restore_tunable READ_SIT_OUT_SECS
42+
restore_tunable SIT_OUT_CHECK_INTERVAL
43+
log_must zinject -c all
44+
destroy_pool $TESTPOOL2
45+
log_must rm -f $TEST_BASE_DIR/vdev.$$.*
46+
}
47+
48+
log_assert "Verify sit_out works"
49+
50+
log_onexit cleanup
51+
52+
save_tunable SIT_OUT_CHECK_INTERVAL
53+
set_tunable64 SIT_OUT_CHECK_INTERVAL 20
54+
55+
log_must truncate -s 150M $TEST_BASE_DIR/vdev.$$.{0..9}
56+
57+
log_must zpool create $TESTPOOL2 draid2 $TEST_BASE_DIR/vdev.$$.{0..9}
58+
log_must dd if=/dev/urandom of=/$TESTPOOL2/bigfile bs=1M count=400
59+
log_must zpool export $TESTPOOL2
60+
log_must zpool import -d $TEST_BASE_DIR $TESTPOOL2
61+
62+
BAD_VDEV1=$TEST_BASE_DIR/vdev.$$.7
63+
BAD_VDEV2=$TEST_BASE_DIR/vdev.$$.8
64+
BAD_VDEV3=$TEST_BASE_DIR/vdev.$$.9
65+
66+
# Initial state should not be sitting out
67+
log_must eval [[ "$(get_vdev_prop autosit $TESTPOOL2 draid2-0)" == "on" ]]
68+
log_must eval [[ "$(get_vdev_prop sit_out $TESTPOOL2 $BAD_VDEV1)" == "off" ]]
69+
log_must eval [[ "$(get_vdev_prop sit_out $TESTPOOL2 $BAD_VDEV2)" == "off" ]]
70+
log_must eval [[ "$(get_vdev_prop sit_out $TESTPOOL2 $BAD_VDEV3)" == "off" ]]
71+
72+
# Delay our reads 200ms to trigger sit out
73+
log_must zinject -d $BAD_VDEV1 -D200:1 -T read $TESTPOOL2
74+
75+
# Do some reads and wait for us to sit out
76+
for i in {1..100} ; do
77+
dd if=/$TESTPOOL2/bigfile skip=$i bs=2M count=1 of=/dev/null
78+
79+
sit_out=$(get_vdev_prop sit_out $TESTPOOL2 $BAD_VDEV1)
80+
if [[ "$sit_out" == "on" ]] ; then
81+
break
82+
fi
83+
done
84+
log_must test "$(get_vdev_prop sit_out $TESTPOOL2 $BAD_VDEV1)" == "on"
85+
86+
log_must zinject -d $BAD_VDEV2 -D200:1 -T read $TESTPOOL2
87+
# Do some reads and wait for us to sit out
88+
for i in {1..100} ; do
89+
dd if=/$TESTPOOL2/bigfile skip=$i bs=2M count=1 of=/dev/null
90+
91+
sit_out=$(get_vdev_prop sit_out $TESTPOOL2 $BAD_VDEV2)
92+
if [[ "$sit_out" == "on" ]] ; then
93+
break
94+
fi
95+
done
96+
log_must test "$(get_vdev_prop sit_out $TESTPOOL2 $BAD_VDEV2)" == "on"
97+
98+
log_must zinject -d $BAD_VDEV3 -D200:1 -T read $TESTPOOL2
99+
# Do some reads and wait for us to sit out
100+
for i in {1..100} ; do
101+
dd if=/$TESTPOOL2/bigfile skip=$i bs=2M count=1 of=/dev/null
102+
103+
sit_out=$(get_vdev_prop sit_out $TESTPOOL2 $BAD_VDEV3)
104+
if [[ "$sit_out" == "on" ]] ; then
105+
break
106+
fi
107+
done
108+
log_must test "$(get_vdev_prop sit_out $TESTPOOL2 $BAD_VDEV3)" == "off"
109+
110+
111+
log_pass "sit_out works correctly"

0 commit comments

Comments
 (0)