@@ -39,17 +39,19 @@ log_assert $claim
3939
4040DS1=" $TESTPOOL /encrypted1"
4141DS2=" $TESTPOOL /encrypted2"
42+ DS1_NC=" $TESTPOOL /notcrypted1"
4243PASSPHRASE=" top_secret"
4344
4445function 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
150153typeset hash2=$( md5digest " /$DS1 /file" )
151154log_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+
153168log_must sync_pool $TESTPOOL
154169
155170log_pass $claim
0 commit comments