From: Eric Biggers <ebiggers@kernel.org>
To: Jeff Layton <jlayton@kernel.org>
Cc: fstests@vger.kernel.org, Luis Henriques <lhenriques@suse.de>
Subject: Re: [PATCH v3] common/encrypt, ceph: add _require_not_encrypted test
Date: Wed, 15 Dec 2021 16:45:34 -0800 [thread overview]
Message-ID: <YbqMLgoYh8ZI+8bR@sol.localdomain> (raw)
In-Reply-To: <20211215190248.111263-1-jlayton@kernel.org>
On Wed, Dec 15, 2021 at 02:02:48PM -0500, Jeff Layton wrote:
> Some tests on ceph require changing the layout of new files, which is
> forbidden when the files are encrypted. Add a test that touches a file
> in $TEST_DIR and then tests it to see if it reports the
> STATX_ATTR_ENCRYPTED flag, and does a _notrun if it's present.
>
> Also add this requirement to three ceph tests that change the layout.
>
> Cc: Luis Henriques <lhenriques@suse.de>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
> common/encrypt | 18 ++++++++++++++++++
> tests/ceph/001 | 2 ++
> tests/ceph/002 | 2 ++
> tests/ceph/003 | 2 ++
> 4 files changed, 24 insertions(+)
>
> v2: make ceph/001 also call _require_not_encrypted
>
> v3: move test into common/encrypt
>
> diff --git a/common/encrypt b/common/encrypt
> index f90c4ef05a3f..156425af40a8 100644
> --- a/common/encrypt
> +++ b/common/encrypt
> @@ -940,3 +940,21 @@ _filter_nokey_filenames()
> # of characters that have ever been used in such names.
> sed "s|${dir}${dir:+/}[A-Za-z0-9+,_-]\+|${dir}${dir:+/}NOKEY_NAME|g"
> }
> +
> +# Some tests require that encryption not be enabled.
> +_require_not_encrypted()
> +{
> + local target=$TEST_DIR/require_not_encrypted.$$
> + local ret=0
> +
> + #
> + # The top-level directory mounted with test_dummy_encryption is not
> + # itself encrypted. Only new files and directories created under it
> + # are.
> + touch $target
> + local attrs=$($XFS_IO_PROG -c 'statx -r' $target | awk '/stat.attributes / { print $3 }')
> + rm -f $target
> +
> + # STATX_ATTR_ENCRYPTED == 0x800
> + [ $(( attrs & 0x800 )) -eq 0 ] || _notrun "Filesystem is encrypted"
> +}
Did you consider instead skipping the test if the mount options contain
test_dummy_encryption? That's the way that the encryption tests currently
detect that they shouldn't run (since the automatic encryption caused by
test_dummy_encryption would interfere with them); see
_require_scratch_encryption(). What you've done here will work too, but it
might make sense to check for test_dummy_encryption the same way in both places.
- Eric
next prev parent reply other threads:[~2021-12-16 0:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-15 19:02 [PATCH v3] common/encrypt, ceph: add _require_not_encrypted test Jeff Layton
2021-12-16 0:45 ` Eric Biggers [this message]
2021-12-16 10:04 ` Luís Henriques
2021-12-19 13:20 ` Eryu Guan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YbqMLgoYh8ZI+8bR@sol.localdomain \
--to=ebiggers@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=jlayton@kernel.org \
--cc=lhenriques@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.