* [PATCH] common/rc, ceph: add _require_not_encrypted test
@ 2021-12-15 14:20 Jeff Layton
2021-12-15 16:01 ` Luís Henriques
0 siblings, 1 reply; 3+ messages in thread
From: Jeff Layton @ 2021-12-15 14:20 UTC (permalink / raw)
To: fstests; +Cc: Luis Henriques
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 the two ceph tests that change the layout.
Cc: Luis Henriques <lhenriques@suse.de>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
common/rc | 17 +++++++++++++++++
tests/ceph/002 | 1 +
tests/ceph/003 | 1 +
3 files changed, 19 insertions(+)
diff --git a/common/rc b/common/rc
index 7973ceb5fdf8..9165325dc478 100644
--- a/common/rc
+++ b/common/rc
@@ -4782,6 +4782,23 @@ _require_kernel_config()
_has_kernel_config $1 || _notrun "Installed kernel not built with $1"
}
+_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"
+}
+
init_rc
################################################################################
diff --git a/tests/ceph/002 b/tests/ceph/002
index 9bc728fd2e18..be5c0f8c644d 100755
--- a/tests/ceph/002
+++ b/tests/ceph/002
@@ -30,6 +30,7 @@ _begin_fstest auto quick copy_range
_supported_fs ceph
_require_xfs_io_command "copy_range"
+_require_not_encrypted
_require_attrs
_require_test
diff --git a/tests/ceph/003 b/tests/ceph/003
index faedb48cfeea..c8aefc4ad06f 100755
--- a/tests/ceph/003
+++ b/tests/ceph/003
@@ -18,6 +18,7 @@ _begin_fstest auto quick copy_range
_supported_fs ceph
_require_xfs_io_command "copy_range"
+_require_not_encrypted
_require_attrs
_require_test
--
2.33.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] common/rc, ceph: add _require_not_encrypted test
2021-12-15 14:20 [PATCH] common/rc, ceph: add _require_not_encrypted test Jeff Layton
@ 2021-12-15 16:01 ` Luís Henriques
2021-12-15 19:03 ` Jeff Layton
0 siblings, 1 reply; 3+ messages in thread
From: Luís Henriques @ 2021-12-15 16:01 UTC (permalink / raw)
To: Jeff Layton; +Cc: fstests
Hi Jeff,
On Wed, Dec 15, 2021 at 09:20:47AM -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 the two ceph tests that change the layout.
Aren't you forgetting ceph/001?
> Cc: Luis Henriques <lhenriques@suse.de>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
> common/rc | 17 +++++++++++++++++
> tests/ceph/002 | 1 +
> tests/ceph/003 | 1 +
> 3 files changed, 19 insertions(+)
>
> diff --git a/common/rc b/common/rc
> index 7973ceb5fdf8..9165325dc478 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -4782,6 +4782,23 @@ _require_kernel_config()
> _has_kernel_config $1 || _notrun "Installed kernel not built with $1"
> }
>
> +_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"
> +}
> +
Maybe this function could be in the 'common/encrypt' file instead.
Other than these 2 comments, I also agree that this approach is better
than hooking into the _ceph_create_file_layout() function.
Cheers,
--
Luís
> init_rc
>
> ################################################################################
> diff --git a/tests/ceph/002 b/tests/ceph/002
> index 9bc728fd2e18..be5c0f8c644d 100755
> --- a/tests/ceph/002
> +++ b/tests/ceph/002
> @@ -30,6 +30,7 @@ _begin_fstest auto quick copy_range
> _supported_fs ceph
>
> _require_xfs_io_command "copy_range"
> +_require_not_encrypted
> _require_attrs
> _require_test
>
> diff --git a/tests/ceph/003 b/tests/ceph/003
> index faedb48cfeea..c8aefc4ad06f 100755
> --- a/tests/ceph/003
> +++ b/tests/ceph/003
> @@ -18,6 +18,7 @@ _begin_fstest auto quick copy_range
> _supported_fs ceph
>
> _require_xfs_io_command "copy_range"
> +_require_not_encrypted
> _require_attrs
> _require_test
>
> --
> 2.33.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] common/rc, ceph: add _require_not_encrypted test
2021-12-15 16:01 ` Luís Henriques
@ 2021-12-15 19:03 ` Jeff Layton
0 siblings, 0 replies; 3+ messages in thread
From: Jeff Layton @ 2021-12-15 19:03 UTC (permalink / raw)
To: Luís Henriques; +Cc: fstests
On Wed, 2021-12-15 at 16:01 +0000, Luís Henriques wrote:
> Hi Jeff,
>
> On Wed, Dec 15, 2021 at 09:20:47AM -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 the two ceph tests that change the layout.
>
> Aren't you forgetting ceph/001?
>
> > Cc: Luis Henriques <lhenriques@suse.de>
> > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> > ---
> > common/rc | 17 +++++++++++++++++
> > tests/ceph/002 | 1 +
> > tests/ceph/003 | 1 +
> > 3 files changed, 19 insertions(+)
> >
> > diff --git a/common/rc b/common/rc
> > index 7973ceb5fdf8..9165325dc478 100644
> > --- a/common/rc
> > +++ b/common/rc
> > @@ -4782,6 +4782,23 @@ _require_kernel_config()
> > _has_kernel_config $1 || _notrun "Installed kernel not built with $1"
> > }
> >
> > +_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"
> > +}
> > +
>
> Maybe this function could be in the 'common/encrypt' file instead.
>
> Other than these 2 comments, I also agree that this approach is better
> than hooking into the _ceph_create_file_layout() function.
>
> Cheers,
> --
> Luís
>
v3 patch sent that should address your comments.
Thanks!
> > init_rc
> >
> > ################################################################################
> > diff --git a/tests/ceph/002 b/tests/ceph/002
> > index 9bc728fd2e18..be5c0f8c644d 100755
> > --- a/tests/ceph/002
> > +++ b/tests/ceph/002
> > @@ -30,6 +30,7 @@ _begin_fstest auto quick copy_range
> > _supported_fs ceph
> >
> > _require_xfs_io_command "copy_range"
> > +_require_not_encrypted
> > _require_attrs
> > _require_test
> >
> > diff --git a/tests/ceph/003 b/tests/ceph/003
> > index faedb48cfeea..c8aefc4ad06f 100755
> > --- a/tests/ceph/003
> > +++ b/tests/ceph/003
> > @@ -18,6 +18,7 @@ _begin_fstest auto quick copy_range
> > _supported_fs ceph
> >
> > _require_xfs_io_command "copy_range"
> > +_require_not_encrypted
> > _require_attrs
> > _require_test
> >
> > --
> > 2.33.1
> >
--
Jeff Layton <jlayton@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-12-15 19:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-15 14:20 [PATCH] common/rc, ceph: add _require_not_encrypted test Jeff Layton
2021-12-15 16:01 ` Luís Henriques
2021-12-15 19:03 ` Jeff Layton
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.