5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
24 # Copyright (c) 2017 by Lawrence Livermore National Security, LLC.
25 # Use is subject to license terms.
29 # Verify zio deadman detects a hung zio
32 # 1. Reduce the zfs_deadman_ziotime_ms to 5s.
33 # 2. Reduce the zfs_deadman_checktime_ms to 1s.
34 # 3. Inject a 10s zio delay to force long IOs.
35 # 4. Read an uncached file in the background.
36 # 5. Verify a "deadman" event is posted.
37 # 6. Inject a 100ms zio delay which is under the 5s allowed.
38 # 7. Read an uncached file in the background.
39 # 8. Verify a "deadman" event is not posted.
42 .
$STF_SUITE/include
/libtest.shlib
43 .
$STF_SUITE/tests
/functional
/deadman
/deadman.cfg
45 verify_runnable
"both"
49 log_must zinject
-c all
50 default_cleanup_noexit
52 log_must set_tunable64 zfs_deadman_ziotime_ms
$ZIOTIME_DEFAULT
53 log_must set_tunable64 zfs_deadman_checktime_ms
$CHECKTIME_DEFAULT
54 log_must set_tunable64 zfs_deadman_failmode
$FAILMODE_DEFAULT
57 log_assert
"Verify zio deadman detects a hung zio"
60 # 1. Reduce the zfs_deadman_ziotime_ms to 5s.
61 log_must set_tunable64 zfs_deadman_ziotime_ms
5000
62 # 2. Reduce the zfs_deadman_checktime_ms to 1s.
63 log_must set_tunable64 zfs_deadman_checktime_ms
1000
64 log_must set_tunable64 zfs_deadman_failmode
"wait"
66 # Create a new pool in order to use the updated deadman settings.
67 default_setup_noexit
$DISK1
69 # Write a file and export/import the pool to clear the ARC.
70 mntpnt
=$
(get_prop mountpoint
$TESTPOOL/$TESTFS)
71 log_must file_write
-b 1048576 -c 8 -o create
-d 0 -f $mntpnt/file1
72 log_must file_write
-b 1048576 -c 8 -o create
-d 0 -f $mntpnt/file2
73 log_must zpool
export $TESTPOOL
74 log_must zpool import
$TESTPOOL
75 log_must stat
-t /$mntpnt/file1
76 log_must stat
-t /$mntpnt/file2
78 # 3. Inject a 10s zio delay to force long IOs and serialize them..
79 log_must zpool events
-c
80 log_must zinject
-d $DISK1 -D10000:1 $TESTPOOL
82 # 4. Read an uncached file in the background, it's expected to hang.
83 log_must
eval "dd if=/$mntpnt/file1 of=/dev/null bs=1048576 &"
85 log_must zinject
-c all
89 # 5. Verify a "deadman" event is posted. The first appears after 5
90 # seconds, and another each second thereafter until the delay is cleared.
91 events
=$
(zpool events |
grep -c ereport.fs.zfs.deadman
)
92 if [ "$events" -lt 1 ]; then
93 log_fail
"Expect >=1 deadman events, $events found"
96 # 6. Inject a 100ms zio delay which is under the 5s allowed, allow them
97 # to run concurrently so they don't get starved in the queue.
98 log_must zpool events
-c
99 log_must zinject
-d $DISK1 -D100:10 $TESTPOOL
101 # 7. Read an uncached file in the background.
102 log_must
eval "dd if=/$mntpnt/file2 of=/dev/null bs=1048576 &"
104 log_must zinject
-c all
107 # 8. Verify a "deadman" event is not posted.
108 events
=$
(zpool events |
grep -c ereport.fs.zfs.deadman
)
109 if [ "$events" -ne 0 ]; then
110 log_fail
"Expect 0 deadman events, $events found"
113 log_pass
"Verify zio deadman detected a hung zio and $events deadman events"