Skip to content

Commit 641f06c

Browse files
committed
Added more block cross clone test:
- cloning from non-encrypted to encrypted datasets - cloning from encrypted to non-encrypted datasets Signed-off-by: Kay Pedersen <mail@mkwg.de>
1 parent 57ea1ad commit 641f06c

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

tests/zfs-tests/tests/functional/block_cloning/block_cloning_cross_enc_dataset.ksh

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,19 @@ log_assert $claim
3939

4040
DS1="$TESTPOOL/encrypted1"
4141
DS2="$TESTPOOL/encrypted2"
42+
DS1_NC="$TESTPOOL/notcrypted1"
4243
PASSPHRASE="top_secret"
4344

4445
function prepare_enc
4546
{
4647
log_must zpool create -o feature@block_cloning=enabled $TESTPOOL $DISKS
4748
log_must eval "echo $PASSPHRASE | zfs create -o encryption=on" \
48-
"-o keyformat=passphrase $DS1"
49+
"-o keyformat=passphrase -o keylocation=prompt $DS1"
4950
log_must eval "echo $PASSPHRASE | zfs create -o encryption=on" \
5051
"-o keyformat=passphrase -o keylocation=prompt $DS2"
5152
log_must zfs create $DS1/child1
5253
log_must zfs create $DS1/child2
54+
log_must zfs create $DS1_NC
5355

5456
log_note "Create test file"
5557
# we must wait until the src file txg is written to the disk otherwise we
@@ -58,6 +60,7 @@ function prepare_enc
5860
# "zfs/module/zfs/zfs_vnops.c"
5961
log_must dd if=/dev/urandom of=/$DS1/file bs=128K count=4
6062
log_must dd if=/dev/urandom of=/$DS1/child1/file bs=128K count=4
63+
log_must dd if=/dev/urandom of=/$DS1_NC/file bs=128K count=4
6164
log_must sync_pool $TESTPOOL
6265
}
6366

@@ -150,6 +153,18 @@ log_must sync_pool $TESTPOOL
150153
typeset hash2=$(md5digest "/$DS1/file")
151154
log_must [ "$hash1" = "$hash2" ]
152155

156+
cleanup_enc
157+
prepare_enc
158+
159+
log_note "Copying with copy_file_range from non encrypted to encrypted"
160+
clone_and_check "file" "copy" $DS1_NC $DS1 "" true
161+
162+
cleanup_enc
163+
prepare_enc
164+
165+
log_note "Copying with copy_file_range from encrypted to non encrypted"
166+
clone_and_check "file" "copy" $DS1 $DS1_NC "" true
167+
153168
log_must sync_pool $TESTPOOL
154169

155170
log_pass $claim

0 commit comments

Comments
 (0)