Re: [PATCH] ceph: fix up test_dummy_encryption handling for new mount API

From: Jeff Layton
Date: Wed Jul 13 2022 - 14:56:23 EST


On Wed, 2022-07-13 at 20:55 +0800, Xiubo Li wrote:
> Hi Jeff,
>
> I am rebasing the 'wip-fscrypt' branch to the 'testing', and there is
> one commit conflicts:
>
> commit 81faddddbef409bcaa1aa3d89e59606cde94dab7
> Author: Jeff Layton <jlayton@xxxxxxxxxx>
> Date:   Wed Dec 1 09:21:39 2021 -0500
>
>     ceph: add infrastructure for file encryption and decryption
>
>     ...and allow test_dummy_encryption to bypass content encryption
>     if mounted with test_dummy_encryption=clear.
>
>     Reviewed-by: Xiubo Li <xiubli@xxxxxxxxxx>
>     Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
>
> And the conflicts are:
>
> [xiubli@fedora ]$ cat fs/ceph/super.h.rej
> --- fs/ceph/super.h
> +++ fs/ceph/super.h
> @@ -45,6 +45,7 @@
>  #define CEPH_MOUNT_OPT_NOPAGECACHE     (1<<16) /* bypass pagecache
> altogether */
>  #define CEPH_MOUNT_OPT_SPARSEREAD      (1<<17) /* always do sparse
> reads */
>  #define CEPH_MOUNT_OPT_TEST_DUMMY_ENC  (1<<18) /* enable dummy
> encryption (for testing) */
> +#define CEPH_MOUNT_OPT_DUMMY_ENC_CLEAR (1<<19) /* don't actually
> encrypt content */
>
>  #define CEPH_MOUNT_OPT_DEFAULT            \
>      (CEPH_MOUNT_OPT_DCACHE |        \
>
> [xiubli@fedora ]$ cat fs/ceph/super.c.rej
> --- fs/ceph/super.c
> +++ fs/ceph/super.c
> @@ -1098,6 +1098,14 @@ static int ceph_set_test_dummy_encryption(struct
> super_block *sb, struct fs_cont
>              return -EEXIST;
>          }
>
> +        /* HACK: allow for cleartext "encryption" in files for testing */
> +        if (fsc->mount_options->test_dummy_encryption &&
> + !strcmp(fsc->mount_options->test_dummy_encryption, "clear")) {
> +            fsopt->flags |= CEPH_MOUNT_OPT_DUMMY_ENC_CLEAR;
> + kfree(fsc->mount_options->test_dummy_encryption);
> +            fsc->mount_options->test_dummy_encryption = NULL;
> +        }
> +
>          err = fscrypt_set_test_dummy_encryption(sb,
> fsc->mount_options->test_dummy_encryption,
>                              &fsc->dummy_enc_policy);
>
> And I have pushed the tmp patches to
> https://github.com/lxbsz/ceph-client/commits/lxb-wip-fscrypt3.
>
> Please take a look is that okay ?
>
> Thanks
>
> -- Xiubo
>
>

The result looks good to me. Thanks for fixing this up.

--
Jeff Layton <jlayton@xxxxxxxxxx>