From a51b6d91a85e8ade7e02fc39b828e2ef704a7f89 Mon Sep 17 00:00:00 2001 From: oromenahar Date: Wed, 29 Nov 2023 20:01:40 +0100 Subject: [PATCH] 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 --- .../block_cloning_cross_enc_dataset.ksh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/zfs-tests/tests/functional/block_cloning/block_cloning_cross_enc_dataset.ksh b/tests/zfs-tests/tests/functional/block_cloning/block_cloning_cross_enc_dataset.ksh index 2b677515824f..fe8f0867b909 100755 --- a/tests/zfs-tests/tests/functional/block_cloning/block_cloning_cross_enc_dataset.ksh +++ b/tests/zfs-tests/tests/functional/block_cloning/block_cloning_cross_enc_dataset.ksh @@ -39,17 +39,19 @@ log_assert $claim DS1="$TESTPOOL/encrypted1" DS2="$TESTPOOL/encrypted2" +DS1_NC="$TESTPOOL/notcrypted1" PASSPHRASE="top_secret" function prepare_enc { log_must zpool create -o feature@block_cloning=enabled $TESTPOOL $DISKS log_must eval "echo $PASSPHRASE | zfs create -o encryption=on" \ - "-o keyformat=passphrase $DS1" + "-o keyformat=passphrase -o keylocation=prompt $DS1" log_must eval "echo $PASSPHRASE | zfs create -o encryption=on" \ "-o keyformat=passphrase -o keylocation=prompt $DS2" log_must zfs create $DS1/child1 log_must zfs create $DS1/child2 + log_must zfs create $DS1_NC log_note "Create test file" # we must wait until the src file txg is written to the disk otherwise we @@ -58,6 +60,7 @@ function prepare_enc # "zfs/module/zfs/zfs_vnops.c" log_must dd if=/dev/urandom of=/$DS1/file bs=128K count=4 log_must dd if=/dev/urandom of=/$DS1/child1/file bs=128K count=4 + log_must dd if=/dev/urandom of=/$DS1_NC/file bs=128K count=4 log_must sync_pool $TESTPOOL } @@ -150,6 +153,18 @@ log_must sync_pool $TESTPOOL typeset hash2=$(md5digest "/$DS1/file") log_must [ "$hash1" = "$hash2" ] +cleanup_enc +prepare_enc + +log_note "Copying with copy_file_range from non encrypted to encrypted" +clone_and_check "file" "copy" $DS1_NC $DS1 "" true + +cleanup_enc +prepare_enc + +log_note "Copying with copy_file_range from encrypted to non encrypted" +clone_and_check "file" "copy" $DS1 $DS1_NC "" true + log_must sync_pool $TESTPOOL log_pass $claim