-
Notifications
You must be signed in to change notification settings - Fork 1.9k
ZTS: Add LUKS sanity test #16681
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
ZTS: Add LUKS sanity test #16681
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,6 +129,7 @@ export SYSTEM_FILES_LINUX='attr | |
blkdiscard | ||
blockdev | ||
chattr | ||
cryptsetup | ||
exportfs | ||
fallocate | ||
flock | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
#!/bin/ksh -p | ||
# | ||
# CDDL HEADER START | ||
# | ||
# The contents of this file are subject to the terms of the | ||
# Common Development and Distribution License (the "License"). | ||
# You may not use this file except in compliance with the License. | ||
# | ||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE | ||
# or https://opensource.org/licenses/CDDL-1.0. | ||
# See the License for the specific language governing permissions | ||
# and limitations under the License. | ||
# | ||
# When distributing Covered Code, include this CDDL HEADER in each | ||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. | ||
# If applicable, add the following below this CDDL HEADER, with the | ||
# fields enclosed by brackets "[]" replaced with your own identifying | ||
# information: Portions Copyright [yyyy] [name of copyright owner] | ||
# | ||
# CDDL HEADER END | ||
# | ||
|
||
# | ||
# Copyright (c) 2024 by Lawrence Livermore National Security, LLC. | ||
# Use is subject to license terms. | ||
# | ||
|
||
# DESCRIPTION: | ||
# Verify ZFS works on a LUKS-backed pool | ||
# | ||
# STRATEGY: | ||
# 1. Create a LUKS device | ||
# 2. Make a pool with it | ||
# 3. Write files to the pool | ||
# 4. Verify no errors | ||
|
||
. $STF_SUITE/include/libtest.shlib | ||
|
||
verify_runnable "both" | ||
|
||
VDEV=$(mktemp --suffix=luks_sanity) | ||
TESTPOOL=testpool | ||
|
||
function cleanup | ||
{ | ||
log_must zpool destroy $TESTPOOL | ||
|
||
log_must cryptsetup luksClose /dev/mapper/luksdev | ||
log_must rm -f $VDEV | ||
} | ||
|
||
log_assert "Verify ZFS on LUKS works" | ||
log_onexit cleanup | ||
|
||
PASS="fdsjfosdijfsdkjsldfjdlk" | ||
|
||
# Make a small LUKS device since LUKS formatting takes time and we want to | ||
# make this test run as quickly as possible. | ||
truncate -s 100M $VDEV | ||
|
||
log_must cryptsetup luksFormat --type luks2 $VDEV <<< $PASS | ||
log_must cryptsetup luksOpen $VDEV luksdev <<< $PASS | ||
|
||
log_must zpool create $TESTPOOL /dev/mapper/luksdev | ||
|
||
CPUS=$(get_num_cpus) | ||
|
||
# Use these specific size and offset ranges as they often cause errors with | ||
# https://github.com/openzfs/zfs/issues/16631 | ||
# and we want to try to test for that. | ||
for SIZE in {70..100} ; do | ||
for OFF in {70..100} ; do | ||
for i in {1..$CPUS} ; do | ||
behlendorf marked this conversation as resolved.
Show resolved
Hide resolved
|
||
dd if=/dev/urandom of=/$TESTPOOL/file$i-bs$SIZE-off$OFF \ | ||
seek=$OFF bs=$SIZE count=1 &>/dev/null & | ||
done | ||
wait | ||
done | ||
sync_pool $TESTPOOL | ||
rm -f /$TESTPOOL/file* | ||
tonyhutter marked this conversation as resolved.
Show resolved
Hide resolved
|
||
done | ||
|
||
# Verify no read/write/checksum errors. Don't use JSON here so that we could | ||
# could potentially backport this test case to the 2.2.x branch. | ||
if zpool status -e | grep -q "luksdev" ; then | ||
log_note "$(zpool status -v)" | ||
log_fail "Saw errors writing to LUKS device" | ||
fi | ||
|
||
log_pass "Verified ZFS on LUKS works" |
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.
Uh oh!
There was an error while loading. Please reload this page.