Whamcloud - gitweb
LU-14401 sec: fix migrate for encrypted dir
authorSebastien Buisson <sbuisson@ddn.com>
Thu, 4 Feb 2021 08:22:56 +0000 (17:22 +0900)
committerLi Xi <lixi@ddn.com>
Wed, 17 Mar 2021 07:42:33 +0000 (07:42 +0000)
commite84b9964c6fb320cdc580aef7aab6a1eadc6ead5
treef12c762321f5505fcfc6739966a7d6116897d93f
parentd9ec3ea9548a949d4ee5ff6a271f93f003325dd1
LU-14401 sec: fix migrate for encrypted dir

When setting an encryption policy on a directory that we want to
be encrypted, we need to make sure it is empty.
But, in some cases, setting the LL_XATTR_NAME_ENCRYPTION_CONTEXT xattr
should be allowed on non-empty directories, for instance when a
directory is migrated across MDTs into new shard directories.
Also, it is required for the encrpytion key to be available on the
client when migrating a directory so that the filenames can be
properly rehashed for the new MDT directory shard.
And, in any case, we need to prevent explicit setting of
LL_XATTR_NAME_ENCRYPTION_CONTEXT xattr outside of encryption policy
definition.

Update sanity-sec test_49 to test migration of non-empty encrypted
directory, and add sanity-sec test_57 to test security.c protection.

Lustre-change: https://review.whamcloud.com/41413
Lustre-commit: 67c4cffac6dbd30ce30e1d3132b65d4e4a374dda

Test-Parameters: clientdistro=el8.3 testlist=sanity-sec
Fixes: e8f74fb0f5 ("LU-12275 sec: verify dir is empty when setting enc policy")
Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Change-Id: I2466ea35a871c6c07bdcf9fba7191485e855e655
Reviewed-on: https://review.whamcloud.com/42043
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Li Xi <lixi@ddn.com>
lustre/llite/crypto.c
lustre/llite/file.c
lustre/llite/llite_internal.h
lustre/llite/xattr.c
lustre/mdd/mdd_internal.h
lustre/tests/sanity-sec.sh