Skip to content

Commit d234dc3

Browse files
author
Rob Wing
committed
tests: add zed_ck_config: test ZED with checksum_n and checksum_t
Test ZED configurability 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 7b544d2 commit d234dc3

File tree

3 files changed

+161
-1
lines changed

3 files changed

+161
-1
lines changed

tests/runfiles/linux.run

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ tests = ['devices_001_pos', 'devices_002_neg', 'devices_003_pos']
8686
tags = ['functional', 'devices']
8787

8888
[tests/functional/events:Linux]
89-
tests = ['events_001_pos', 'events_002_pos', 'zed_rc_filter', 'zed_fd_spill']
89+
tests = ['events_001_pos', 'events_002_pos', 'zed_ck_config',
90+
'zed_rc_filter', 'zed_fd_spill']
9091
tags = ['functional', 'events']
9192

9293
[tests/functional/fadvise:Linux]

tests/zfs-tests/tests/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,6 +1367,7 @@ 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_ck_config.ksh \
13701371
functional/events/zed_fd_spill.ksh \
13711372
functional/events/zed_rc_filter.ksh \
13721373
functional/exec/cleanup.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 by Rob Wing <rob.wing@klarasystems.com>
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"

0 commit comments

Comments
 (0)