Skip to content

Commit

Permalink
Added more block cross clone test:
Browse files Browse the repository at this point in the history
- cloning from non-encrypted to encrypted datasets
- cloning from encrypted to non-encrypted datasets

Signed-off-by: Kay Pedersen <[email protected]>
  • Loading branch information
oromenahar committed Nov 29, 2023
1 parent 0876adc commit a51b6d9
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}

Expand Down Expand Up @@ -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

0 comments on commit a51b6d9

Please sign in to comment.