Skip to content

Commit c8998f7

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 c6b3714 commit c8998f7

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,24 +39,27 @@ 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
5658
# will fallback to normal copy. See "dmu_read_l0_bps" in "zfs/module/zfs/dmu.c"
5759
# and "zfs_clone_range" in "zfs/module/zfs/zfs_vnops.c"
5860
log_must dd if=/dev/urandom of=/$DS1/file bs=128K count=4
5961
log_must dd if=/dev/urandom of=/$DS1/child1/file bs=128K count=4
62+
log_must dd if=/dev/urandom of=/$DS1_NC/file bs=128K count=4
6063
log_must sync_pool $TESTPOOL
6164
}
6265

@@ -141,6 +144,18 @@ log_must zfs destroy -r $DS2@s1
141144
typeset hash2=$(cat "/$DS1/file" | md5sum)
142145
log_must [ "$hash1" = "$hash2" ]
143146

147+
cleanup_enc
148+
prepare_enc
149+
150+
log_note "Copying with copy_file_range from non encrypted to encrypted"
151+
clone_and_check "file" "copy" $DS1_NC $DS1 "" true
152+
153+
cleanup_enc
154+
prepare_enc
155+
156+
log_note "Copying with copy_file_range from encrypted to non encrypted"
157+
clone_and_check "file" "copy" $DS1 $DS1_NC "" true
158+
144159
log_must sync_pool $TESTPOOL
145160

146161
log_pass $claim

0 commit comments

Comments
 (0)