From: Qian Yingjin Date: Fri, 30 Jul 2021 08:47:55 +0000 (+0800) Subject: EX-3571 pcc: disable PCC for encrypted files X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=a14fdef28021e82b02b9d52660477a26713a4ca0;p=fs%2Flustre-release.git EX-3571 pcc: disable PCC for encrypted files When files are encrypted in Lustre using fscrypt, they should normally not be accessible to users without the proper encyrption key. However, if a user has then encryption key loadedwhen they read a file, it may be decrypted in memory and saved to the PCC backend in unencrypted form. Due to the above reason, we just disable PCC caching for encrypted files. Signed-off-by: Qian Yingjin Change-Id: I6c363dcad7a6bc8520350c0295f6e221bec3abb0 Reviewed-on: https://review.whamcloud.com/44433 Reviewed-by: Sebastien Buisson Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- diff --git a/lustre/llite/file.c b/lustre/llite/file.c index ddfb882..c8b84ee 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -3505,6 +3505,9 @@ static long ll_file_unlock_lease(struct file *file, struct ll_ioc_lease *ioc, if (ioc->lil_count != 1) RETURN(-EINVAL); + if (IS_ENCRYPTED(inode)) + RETURN(-EOPNOTSUPP); + arg += sizeof(*ioc); if (copy_from_user(¶m.pa_archive_id, (void __user *)arg, sizeof(__u32))) @@ -4095,6 +4098,9 @@ out_ladvise: if (!inode_owner_or_capable(inode)) RETURN(-EPERM); + if (IS_ENCRYPTED(inode)) + RETURN(-EOPNOTSUPP); + OBD_ALLOC_PTR(attach); if (attach == NULL) RETURN(-ENOMEM); diff --git a/lustre/llite/pcc.c b/lustre/llite/pcc.c index 3e9c2fa..cdfd551 100644 --- a/lustre/llite/pcc.c +++ b/lustre/llite/pcc.c @@ -2204,6 +2204,9 @@ int pcc_file_open(struct inode *inode, struct file *file) if (!S_ISREG(inode->i_mode)) RETURN(0); + if (IS_ENCRYPTED(inode)) + RETURN(0); + pcc_inode_lock(inode); pcci = ll_i2pcci(inode);