-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Encryption and Raw Send Stability Improvements #6864
Closed
Closed
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4d13718
Encryption Stability and On-Disk Format Fixes
ef130d0
Fix for #6916
735fafd
Raw sends must be able to decrease nlevels
852911d
Add 'zfs recv' dnode reallocation test cases
behlendorf 193a718
Change os->os_next_write_raw to work per txg
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 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 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 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 |
---|---|---|
|
@@ -443,6 +443,8 @@ main(int argc, char *argv[]) | |
drro->drr_raw_bonuslen = | ||
BSWAP_32(drro->drr_raw_bonuslen); | ||
drro->drr_toguid = BSWAP_64(drro->drr_toguid); | ||
drro->drr_maxblkid = | ||
BSWAP_64(drro->drr_maxblkid); | ||
} | ||
|
||
payload_size = DRR_OBJECT_PAYLOAD_SIZE(drro); | ||
|
@@ -451,7 +453,8 @@ main(int argc, char *argv[]) | |
(void) printf("OBJECT object = %llu type = %u " | ||
"bonustype = %u blksz = %u bonuslen = %u " | ||
"dn_slots = %u raw_bonuslen = %u " | ||
"flags = %u indblkshift = %u nlevels = %u " | ||
"flags = %u maxblkid = %llu " | ||
"indblkshift = %u nlevels = %u " | ||
"nblkptr = %u\n", | ||
(u_longlong_t)drro->drr_object, | ||
drro->drr_type, | ||
|
@@ -461,6 +464,7 @@ main(int argc, char *argv[]) | |
drro->drr_dn_slots, | ||
drro->drr_raw_bonuslen, | ||
drro->drr_flags, | ||
(u_longlong_t)drro->drr_maxblkid, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't you need to byteswap this above? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good catch. will fix. |
||
drro->drr_indblkshift, | ||
drro->drr_nlevels, | ||
drro->drr_nblkptr); | ||
|
This file contains 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 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,52 @@ | ||
#!/bin/bash | ||
|
||
# This script only gets executed on systemd systems, see mount-zfs.sh for non-systemd systems | ||
|
||
# import the libs now that we know the pool imported | ||
[ -f /lib/dracut-lib.sh ] && dracutlib=/lib/dracut-lib.sh | ||
[ -f /usr/lib/dracut/modules.d/99base/dracut-lib.sh ] && dracutlib=/usr/lib/dracut/modules.d/99base/dracut-lib.sh | ||
. "$dracutlib" | ||
|
||
# load the kernel command line vars | ||
[ -z "$root" ] && root=$(getarg root=) | ||
# If root is not ZFS= or zfs: or rootfstype is not zfs then we are not supposed to handle it. | ||
[ "${root##zfs:}" = "${root}" -a "${root##ZFS=}" = "${root}" -a "$rootfstype" != "zfs" ] && exit 0 | ||
|
||
# There is a race between the zpool import and the pre-mount hooks, so we wait for a pool to be imported | ||
while true; do | ||
zpool list -H | grep -q -v '^$' && break | ||
[[ $(systemctl is-failed zfs-import-cache.service) == 'failed' ]] && exit 1 | ||
[[ $(systemctl is-failed zfs-import-scan.service) == 'failed' ]] && exit 1 | ||
sleep 0.1s | ||
done | ||
|
||
# run this after import as zfs-import-cache/scan service is confirmed good | ||
if [[ "${root}" = "zfs:AUTO" ]] ; then | ||
root=$(zpool list -H -o bootfs | awk '$1 != "-" {print; exit}') | ||
else | ||
root="${root##zfs:}" | ||
root="${root##ZFS=}" | ||
fi | ||
|
||
# if pool encryption is active and the zfs command understands '-o encryption' | ||
if [[ $(zpool list -H -o feature@encryption $(echo "${root}" | awk -F\/ '{print $1}')) == 'active' ]]; then | ||
# check if root dataset has encryption enabled | ||
if $(zfs list -H -o encryption "${root}" | grep -q -v off); then | ||
# figure out where the root dataset has its key, the keylocation should not be none | ||
while true; do | ||
if [[ $(zfs list -H -o keylocation "${root}") == 'none' ]]; then | ||
root=$(echo -n "${root}" | awk 'BEGIN{FS=OFS="/"}{NF--; print}') | ||
[[ "${root}" == '' ]] && exit 1 | ||
else | ||
break | ||
fi | ||
done | ||
# decrypt them | ||
TRY_COUNT=5 | ||
while [ $TRY_COUNT != 0 ]; do | ||
zfs load-key "$root" <<< $(systemd-ask-password "Encrypted ZFS password for ${root}: ") | ||
[[ $? == 0 ]] && break | ||
((TRY_COUNT-=1)) | ||
done | ||
fi | ||
fi |
This file contains 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 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 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 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 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 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 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 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 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
Oops, something went wrong.
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.
Let's make it perfectly clear to anyone who hits this that the dataset can mounted readonly. Here's my suggested wording.
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.
Maybe also specify that a non-raw send from the old dataset can be used to convert it to the new format. Actually, calling it a "backup" might be confusing.
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.
@trisk
The errata page (which gets linked in
zpool status
) explains exactly what can and can't be done with datasets in this state and how best to deal with them. I'm not sure we should try to explain all of that here in the quick status blurb.How so?