-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Wait for txg sync if the last DRR_FREEOBJECTS might result in a hole #14358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
tests/zfs-tests/tests/functional/rsend/send_encrypted_freeobjects.ksh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
#!/bin/ksh | ||
|
||
# | ||
# This file and its contents are supplied under the terms of the | ||
# Common Development and Distribution License ("CDDL"), version 1.0. | ||
# You may only use this file in accordance with the terms of version | ||
# 1.0 of the CDDL. | ||
# | ||
# A full copy of the text of the CDDL should have accompanied this | ||
# source. A copy of the CDDL is also available via the Internet at | ||
# http://www.illumos.org/license/CDDL. | ||
# | ||
|
||
# | ||
# Copyright (c) 2017 by Lawrence Livermore National Security, LLC. | ||
# Copyright (c) 2023 by Findity AB | ||
# | ||
|
||
. $STF_SUITE/tests/functional/rsend/rsend.kshlib | ||
|
||
# | ||
# Description: | ||
# Verify that receiving a raw encrypted stream, with a FREEOBJECTS | ||
# removing all existing objects in a block followed by an OBJECT write | ||
# to the same block, does not result in a panic. | ||
# | ||
# Strategy: | ||
# 1. Create a new encrypted filesystem | ||
# 2. Create file f1 as the first object in some block (here object 128) | ||
# 3. Take snapshot A | ||
# 4. Create file f2 as the second object in the same block (here object 129) | ||
# 5. Delete f1 | ||
# 6. Take snapshot B | ||
# 7. Receive a full raw encrypted send of A | ||
# 8. Receive an incremental raw send of B | ||
# | ||
verify_runnable "both" | ||
|
||
function create_object_with_num | ||
{ | ||
file=$1 | ||
num=$2 | ||
|
||
tries=100 | ||
for ((i=0; i<$tries; i++)); do | ||
touch $file | ||
onum=$(ls -li $file | awk '{print $1}') | ||
|
||
if [[ $onum -ne $num ]] ; then | ||
rm -f $file | ||
else | ||
break | ||
fi | ||
done | ||
if [[ $i -eq $tries ]]; then | ||
log_fail "Failed to create object with number $num" | ||
fi | ||
} | ||
|
||
log_assert "FREEOBJECTS followed by OBJECT in encrypted stream does not crash" | ||
|
||
sendds=sendencfods | ||
recvds=recvencfods | ||
keyfile=/$POOL/keyencfods | ||
f1=/$POOL/$sendds/f1 | ||
f2=/$POOL/$sendds/f2 | ||
|
||
log_must eval "echo 'password' > $keyfile" | ||
|
||
# | ||
# xattr=sa and dnodesize=legacy for sequential object numbers, see | ||
# note in send_freeobjects.ksh. | ||
# | ||
log_must zfs create -o xattr=sa -o dnodesize=legacy -o encryption=on \ | ||
-o keyformat=passphrase -o keylocation=file://$keyfile $POOL/$sendds | ||
|
||
create_object_with_num $f1 128 | ||
log_must zfs snap $POOL/$sendds@A | ||
create_object_with_num $f2 129 | ||
log_must rm $f1 | ||
log_must zfs snap $POOL/$sendds@B | ||
|
||
log_must eval "zfs send -w $POOL/$sendds@A | zfs recv $POOL/$recvds" | ||
log_must eval "zfs send -w -i $POOL/$sendds@A $POOL/$sendds@B |" \ | ||
"zfs recv $POOL/$recvds" | ||
|
||
log_pass "FREEOBJECTS followed by OBJECT in encrypted stream did not crash" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a little concerned this won't be entirely reliable since it depends on some assumptions about how object numbers are allocated. But as you pointed out we already do this same trick in
send_freeobjects.ksh
so I'm okay with doing the same thing here.