Skip to content

Commit 36cc58c

Browse files
author
Rob Wing
committed
ZTS: add zed_cksum_config and zed_io_config
zed_io_config: test ZED with io_n and io_t zed_cksum_config: test ZED with checksum_n and checksum_t Sponsored-by: Seagate Technology LLC Submitted-by: Klara, Inc. Signed-off-by: Rob Wing <rob.wing@klarasystems.com>
1 parent 9665f7a commit 36cc58c

File tree

4 files changed

+307
-1
lines changed

4 files changed

+307
-1
lines changed

tests/runfiles/linux.run

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ tags = ['functional', 'devices']
8787

8888
[tests/functional/events:Linux]
8989
tests = ['events_001_pos', 'events_002_pos', 'zed_rc_filter', 'zed_fd_spill',
90-
'zed_cksum_reported']
90+
'zed_cksum_reported', 'zed_cksum_config', 'zed_io_config']
9191
tags = ['functional', 'events']
9292

9393
[tests/functional/fadvise:Linux]

tests/zfs-tests/tests/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,8 +1367,10 @@ nobase_dist_datadir_zfs_tests_tests_SCRIPTS += \
13671367
functional/events/events_001_pos.ksh \
13681368
functional/events/events_002_pos.ksh \
13691369
functional/events/setup.ksh \
1370+
functional/events/zed_cksum_config.ksh \
13701371
functional/events/zed_cksum_reported.ksh \
13711372
functional/events/zed_fd_spill.ksh \
1373+
functional/events/zed_io_config.ksh \
13721374
functional/events/zed_rc_filter.ksh \
13731375
functional/exec/cleanup.ksh \
13741376
functional/exec/exec_001_pos.ksh \
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
#!/bin/ksh -p
2+
# CDDL HEADER START
3+
#
4+
# The contents of this file are subject to the terms of the
5+
# Common Development and Distribution License (the "License").
6+
# You may not use this file except in compliance with the License.
7+
#
8+
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9+
# or https://opensource.org/licenses/CDDL-1.0.
10+
# See the License for the specific language governing permissions
11+
# and limitations under the License.
12+
#
13+
# When distributing Covered Code, include this CDDL HEADER in each
14+
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15+
# If applicable, add the following below this CDDL HEADER, with the
16+
# fields enclosed by brackets "[]" replaced with your own identifying
17+
# information: Portions Copyright [yyyy] [name of copyright owner]
18+
#
19+
# CDDL HEADER END
20+
#
21+
22+
#
23+
# Copyright (c) 2022, Klara Inc.
24+
#
25+
26+
# DESCRIPTION:
27+
# Verify that vdev properties, checksum_n and checksum_t, work with ZED.
28+
#
29+
# STRATEGY:
30+
# 1. Create a pool with single vdev
31+
# 2. Set checksum_n/checksum_t to non-default values
32+
# 3. Inject checksum errors
33+
# 4. Verify that ZED degrades vdev
34+
#
35+
36+
. $STF_SUITE/include/libtest.shlib
37+
. $STF_SUITE/tests/functional/events/events_common.kshlib
38+
39+
verify_runnable "both"
40+
41+
MOUNTDIR="$TEST_BASE_DIR/checksum_mount"
42+
FILEPATH="$MOUNTDIR/checksum_file"
43+
VDEV="$TEST_BASE_DIR/vdevfile.$$"
44+
POOL="checksum_pool"
45+
FILESIZE="10M"
46+
47+
function cleanup
48+
{
49+
log_must zed_stop
50+
51+
log_must zinject -c all
52+
if poolexists $POOL ; then
53+
destroy_pool $POOL
54+
fi
55+
log_must rm -fd $VDEV $MOUNTDIR
56+
}
57+
58+
log_onexit cleanup
59+
60+
log_assert "Test ZED checksum_N and checksum_T configurability"
61+
62+
function do_setup
63+
{
64+
log_must zpool create -f -m $MOUNTDIR $POOL $VDEV
65+
log_must zpool events -c
66+
log_must truncate -s 0 $ZED_DEBUG_LOG
67+
log_must zfs set compression=off $POOL
68+
log_must zfs set primarycache=none $POOL
69+
log_must zfs set recordsize=512 $POOL
70+
}
71+
72+
function do_clean
73+
{
74+
log_must zinject -c all
75+
log_must zpool destroy $POOL
76+
}
77+
78+
function must_degrade
79+
{
80+
log_must wait_vdev_state $POOL $VDEV "DEGRADED" 60
81+
}
82+
83+
function mustnot_degrade
84+
{
85+
log_must file_wait $ZED_DEBUG_LOG 5
86+
log_must wait_vdev_state $POOL $VDEV "ONLINE" 60
87+
}
88+
89+
# Test default settings of ZED:
90+
# checksum_n=10
91+
# checksum_t=600
92+
# fire 10 events, should degrade.
93+
function default_degrade
94+
{
95+
do_setup
96+
97+
log_must mkfile $FILESIZE $FILEPATH
98+
log_must zinject -a -t data -e checksum -T read -f 100 $FILEPATH
99+
100+
blk=0
101+
for _ in {1..10}; do
102+
dd if=$FILEPATH of=/dev/null bs=1 count=1 skip=$blk 2>/dev/null
103+
blk=$((blk+512))
104+
done
105+
106+
must_degrade
107+
108+
do_clean
109+
}
110+
111+
# Set checksum_t=1
112+
# fire 10 events over 2.5 seconds, should not degrade.
113+
function checksum_t_no_degrade
114+
{
115+
do_setup
116+
117+
log_must zpool set checksum_t=1 $POOL $VDEV
118+
log_must mkfile $FILESIZE $FILEPATH
119+
log_must zinject -a -t data -e checksum -T read -f 100 $FILEPATH
120+
121+
blk=0
122+
for _ in {1..10}; do
123+
dd if=$FILEPATH of=/dev/null bs=1 count=1 skip=$blk 2>/dev/null
124+
blk=$((blk+512))
125+
sleep 0.25
126+
done
127+
128+
mustnot_degrade
129+
130+
do_clean
131+
}
132+
133+
# Set checksum_n=1
134+
# fire 1 event, should degrade.
135+
function checksum_n_degrade
136+
{
137+
do_setup
138+
139+
log_must zpool set checksum_n=1 $POOL $VDEV
140+
log_must mkfile $FILESIZE $FILEPATH
141+
log_must zinject -a -t data -e checksum -T read -f 100 $FILEPATH
142+
143+
dd if=$FILEPATH of=/dev/null bs=1 count=1 2>/dev/null
144+
145+
must_degrade
146+
147+
do_clean
148+
}
149+
150+
log_must truncate -s $MINVDEVSIZE $VDEV
151+
log_must mkdir -p $MOUNTDIR
152+
153+
log_must zed_start
154+
default_degrade
155+
checksum_n_degrade
156+
checksum_t_no_degrade
157+
158+
log_pass "Test ZED checksum_N and checksum_T configurability"
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
#!/bin/ksh -p
2+
# CDDL HEADER START
3+
#
4+
# The contents of this file are subject to the terms of the
5+
# Common Development and Distribution License (the "License").
6+
# You may not use this file except in compliance with the License.
7+
#
8+
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9+
# or https://opensource.org/licenses/CDDL-1.0.
10+
# See the License for the specific language governing permissions
11+
# and limitations under the License.
12+
#
13+
# When distributing Covered Code, include this CDDL HEADER in each
14+
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15+
# If applicable, add the following below this CDDL HEADER, with the
16+
# fields enclosed by brackets "[]" replaced with your own identifying
17+
# information: Portions Copyright [yyyy] [name of copyright owner]
18+
#
19+
# CDDL HEADER END
20+
#
21+
22+
#
23+
# Copyright (c) 2022, Klara Inc.
24+
#
25+
26+
# DESCRIPTION:
27+
# Verify that vdev properties, io_n and io_t, work with ZED.
28+
#
29+
# STRATEGY:
30+
# 1. Create a mirrored pool.
31+
# 3. Set io_n/io_t to non-default values
32+
# 3. Inject io errors
33+
# 4. Verify that ZED degrades vdev
34+
35+
. $STF_SUITE/include/libtest.shlib
36+
. $STF_SUITE/tests/functional/events/events_common.kshlib
37+
38+
verify_runnable "both"
39+
40+
MOUNTDIR="$TEST_BASE_DIR/io_mount"
41+
FILEPATH="$MOUNTDIR/io_file"
42+
VDEV="$TEST_BASE_DIR/vdevfile.$$"
43+
VDEV1="$TEST_BASE_DIR/vdevfile1.$$"
44+
POOL="io_pool"
45+
46+
function cleanup
47+
{
48+
log_must zed_stop
49+
50+
log_must zinject -c all
51+
if poolexists $POOL ; then
52+
destroy_pool $POOL
53+
fi
54+
log_must rm -fd $VDEV $VDEV1 $MOUNTDIR
55+
}
56+
log_onexit cleanup
57+
58+
log_assert "Test ZED io_n and io_t configurability"
59+
60+
function setup_pool
61+
{
62+
log_must zpool create -f -m $MOUNTDIR $POOL mirror $VDEV $VDEV1
63+
log_must zpool events -c
64+
log_must truncate -s 0 $ZED_DEBUG_LOG
65+
log_must zfs set compression=off $POOL
66+
log_must zfs set primarycache=none $POOL
67+
log_must zfs set recordsize=512 $POOL
68+
}
69+
70+
function do_clean
71+
{
72+
log_must zinject -c all
73+
log_must zpool destroy $POOL
74+
}
75+
76+
# Test default ZED settings:
77+
# io_n=10 (events)
78+
# io_t=600 (seconds)
79+
# fire 10 events over 2.5 seconds, should degrade.
80+
function default_degrade
81+
{
82+
setup_pool
83+
84+
log_must dd if=/dev/urandom of=$FILEPATH bs=1M count=64
85+
log_must zinject -a -d $VDEV -e io -T read -f 100 $POOL
86+
87+
blk=0
88+
for _ in {1..10}; do
89+
dd if=$FILEPATH of=/dev/null bs=1 count=1 skip=$blk 2>/dev/null
90+
blk=$((blk+512))
91+
sleep 0.25
92+
done
93+
94+
log_must wait_vdev_state $POOL $VDEV "FAULTED" 60
95+
do_clean
96+
}
97+
98+
# set io_n=1
99+
# fire 1 event, should degrade
100+
function io_n_degrade
101+
{
102+
setup_pool
103+
104+
log_must zpool set io_n=1 $POOL $VDEV
105+
log_must dd if=/dev/urandom of=$FILEPATH bs=1M count=64
106+
log_must zinject -a -d $VDEV -e io -T read -f 100 $POOL
107+
108+
dd if=$FILEPATH of=/dev/null bs=1 count=1 2>/dev/null
109+
110+
log_must wait_vdev_state $POOL $VDEV "FAULTED" 60
111+
do_clean
112+
}
113+
114+
# set io_t=1
115+
# fire 10 events over 2.5 seconds, should not degrade
116+
function io_t_nodegrade
117+
{
118+
setup_pool
119+
120+
log_must zpool set io_t=1 $POOL $VDEV
121+
log_must dd if=/dev/urandom of=$FILEPATH bs=1M count=64
122+
log_must zinject -a -d $VDEV -e io -T read -f 100 $POOL
123+
124+
blk=0
125+
for _ in {1..10}; do
126+
dd if=$FILEPATH of=/dev/null bs=1 count=1 skip=$blk 2>/dev/null
127+
blk=$((blk+512))
128+
sleep 0.25
129+
done
130+
131+
log_must file_wait $ZED_DEBUG_LOG 30
132+
log_must wait_vdev_state $POOL $VDEV "ONLINE" 1
133+
134+
do_clean
135+
}
136+
137+
log_must truncate -s $MINVDEVSIZE $VDEV
138+
log_must truncate -s $MINVDEVSIZE $VDEV1
139+
log_must mkdir -p $MOUNTDIR
140+
141+
log_must zed_start
142+
default_degrade
143+
io_n_degrade
144+
io_t_nodegrade
145+
146+
log_pass "Test ZED io_n and io_t configurability"

0 commit comments

Comments
 (0)