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) 2017 Datto, Inc. All rights reserved.
21 . $STF_SUITE/include/libtest.shlib
25 # Scrubs must work on an encrypted dataset with an unloaded key.
28 # 1. Create an encrypted dataset
29 # 2. Generate data on the dataset
30 # 3. Unmount the encrypted dataset and unload its key
32 # 5. Wait for the scrub to complete
33 # 6. Verify the scrub had no errors
34 # 7. Load the dataset key and mount it
37 verify_runnable "global"
41 datasetexists $TESTPOOL/$TESTFS2 && \
42 log_must zfs destroy $TESTPOOL/$TESTFS2
46 log_assert "Scrubs must work on an encrypted dataset with an unloaded key"
48 log_must eval "echo 'password' | zfs create -o encryption=on" \
49 "-o keyformat=passphrase $TESTPOOL/$TESTFS2"
51 typeset mntpnt=$(get_prop mountpoint $TESTPOOL/$TESTFS2)
52 log_must mkfile 10m $mntpnt/file1
55 log_must mkfile 512b $mntpnt/file$i
58 log_must zfs unmount $TESTPOOL/$TESTFS2
59 log_must zfs unload-key $TESTPOOL/$TESTFS2
61 log_must zpool scrub -w $TESTPOOL
63 log_must check_pool_status $TESTPOOL "scan" "with 0 errors"
65 log_must eval "echo 'password' | zfs mount -l $TESTPOOL/$TESTFS2"
67 log_pass "Scrubs work on an encrypted dataset with an unloaded key"