|
| 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