Whamcloud - gitweb
LU-14629 sec: do not block rename of topmost encrypted dir
authorSebastien Buisson <sbuisson@ddn.com>
Mon, 27 Sep 2021 11:36:46 +0000 (13:36 +0200)
committerAndreas Dilger <adilger@whamcloud.com>
Fri, 1 Oct 2021 23:23:46 +0000 (23:23 +0000)
We intentionally forbid file and directory rename from encrypted to
unencrypted directory. But we must not block rename of the topmost
encrypted directory.

Lustre-change: https://review.whamcloud.com/45054
Lustre-commit: 3db8e31797535570e5f2e99f6c8471b49d395efe

Fixes: 1158386ac9 ("LU-14629 sec: forbid file rename from enc to unencrypted dir")
Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Change-Id: I480a24b2b0327e1d9104f216da54720e4f351636
Reviewed-on: https://review.whamcloud.com/45085
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/mdd/mdd_dir.c

index 1a37764..aa490c3 100644 (file)
@@ -2816,8 +2816,8 @@ static int mdd_rename_sanity_check(const struct lu_env *env,
        /* we prevent an encrypted file from being renamed
         * into an unencrypted dir
         */
-       if ((cattr->la_valid & LA_FLAGS &&
-            cattr->la_flags & LUSTRE_ENCRYPT_FL) &&
+       if ((pattr->la_valid & LA_FLAGS &&
+            pattr->la_flags & LUSTRE_ENCRYPT_FL) &&
            !(tpattr->la_valid & LA_FLAGS &&
              tpattr->la_flags & LUSTRE_ENCRYPT_FL))
                RETURN(-EXDEV);