5 # This file and its contents are supplied under the terms of the
6 # Common Development and Distribution License ("CDDL"), version 1.0.
7 # You may only use this file in accordance with the terms of version
10 # A full copy of the text of the CDDL should have accompanied this
11 # source. A copy of the CDDL is also available via the Internet at
12 # http://www.illumos.org/license/CDDL.
18 # Copyright (c) 2019 Datto, Inc. All rights reserved.
21 .
$STF_SUITE/include
/libtest.shlib
25 # Scrubs and self-healing should be able to repair data from additional
26 # copies that may be stored.
30 # 1. Create a dataset with copies=3
31 # 2. Write a file to the dataset
32 # 3. zinject errors into the first and second DVAs of that file
33 # 4. Scrub and verify the scrub repaired all errors
34 # 7. Read the file normally to check that self healing also works
35 # 8. Remove the zinject handler
36 # 9. Scrub again and confirm 0 bytes were scrubbed
39 verify_runnable
"global"
43 destroy_dataset
$TESTPOOL/$TESTFS2
44 log_must zinject
-c all
48 log_assert
"Scrubs and self healing must work with additional copies"
50 log_must zfs create
-o copies
=3 $TESTPOOL/$TESTFS2
51 typeset mntpnt
=$
(get_prop mountpoint
$TESTPOOL/$TESTFS2)
52 log_must mkfile
10m
$mntpnt/file
53 log_must zpool sync
$TESTPOOL
55 log_must zinject
-a -t data
-C 0,1 -e io
$mntpnt/file
57 log_must zpool scrub
$TESTPOOL
58 log_must wait_scrubbed
$TESTPOOL
60 log_must check_pool_status
$TESTPOOL "scan" "with 0 errors"
61 log_must check_pool_status
$TESTPOOL "errors" "No known data errors"
63 log_must
dd if=$mntpnt/file of
=/dev
/null bs
=1M iflag
=fullblock
64 log_must check_pool_status
$TESTPOOL "errors" "No known data errors"
66 log_must zinject
-c all
68 log_must zpool scrub
$TESTPOOL
69 log_must wait_scrubbed
$TESTPOOL
73 log_must check_pool_status
$TESTPOOL "errors" "No known data errors"
74 log_must check_pool_status
$TESTPOOL "scan" "with 0 errors"
75 log_must check_pool_status
$TESTPOOL "scan" "repaired 0B"
77 log_pass
"Scrubs and self healing work with additional copies"