From 0d7b2d670f19070c0a1bef6197b7ec43604b5aaf Mon Sep 17 00:00:00 2001 From: Sebastien Buisson Date: Mon, 27 Sep 2021 13:36:46 +0200 Subject: [PATCH] LU-14629 sec: do not block rename of topmost encrypted dir 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 Change-Id: I480a24b2b0327e1d9104f216da54720e4f351636 Reviewed-on: https://review.whamcloud.com/45085 Tested-by: jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo --- lustre/mdd/mdd_dir.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lustre/mdd/mdd_dir.c b/lustre/mdd/mdd_dir.c index 1a37764..aa490c3 100644 --- a/lustre/mdd/mdd_dir.c +++ b/lustre/mdd/mdd_dir.c @@ -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); -- 1.8.3.1