From: Sebastien Buisson Date: Mon, 27 Sep 2021 11:36:46 +0000 (+0200) Subject: LU-14629 sec: do not block rename of topmost encrypted dir X-Git-Tag: 2.14.55~1 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=3db8e31797535570e5f2e99f6c8471b49d395efe 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. 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/45054 Tested-by: jenkins Reviewed-by: Patrick Farrell Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/mdd/mdd_dir.c b/lustre/mdd/mdd_dir.c index 3c8240c..e53c8b3 100644 --- a/lustre/mdd/mdd_dir.c +++ b/lustre/mdd/mdd_dir.c @@ -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 */ - 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);