Whamcloud - gitweb
LU-14629 sec: do not block rename of topmost encrypted dir 54/45054/3
authorSebastien Buisson <sbuisson@ddn.com>
Mon, 27 Sep 2021 11:36:46 +0000 (13:36 +0200)
committerOleg Drokin <green@whamcloud.com>
Fri, 1 Oct 2021 15:10:22 +0000 (15:10 +0000)
We intentionally forbid file and directory rename from encrypted to
unencrypted directory. But we must not block rename of the topmost
encrypted directory.

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/45054
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/mdd/mdd_dir.c

index 3c8240c..e53c8b3 100644 (file)
@@ -2822,8 +2822,8 @@ static int mdd_rename_sanity_check(const struct lu_env *env,
        /* we prevent an encrypted file from being renamed
         * into an unencrypted dir
         */
        /* 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);
            !(tpattr->la_valid & LA_FLAGS &&
              tpattr->la_flags & LUSTRE_ENCRYPT_FL))
                RETURN(-EXDEV);