From 51f09a4612617b981e16a160e2ce7058f836e6bf Mon Sep 17 00:00:00 2001 From: Boojin Kim Date: Thu, 25 Oct 2018 12:20:31 +0900 Subject: [PATCH] [RAMEN9610-8702][COMMON] fs: support f2fs fmp encryption Change-Id: I6145a8b5062b887daeb06530acfbe14e9ee20e4e Signed-off-by: Boojin Kim --- fs/crypto/fscrypt_private.h | 2 +- fs/crypto/keyinfo.c | 2 +- fs/direct-io.c | 2 +- fs/ext4/inode.c | 2 ++ include/linux/fscrypt_notsupp.h | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/fs/crypto/fscrypt_private.h b/fs/crypto/fscrypt_private.h index 9d2873ad6ce3..84b2e14243cc 100644 --- a/fs/crypto/fscrypt_private.h +++ b/fs/crypto/fscrypt_private.h @@ -129,7 +129,7 @@ static inline int __fscrypt_disk_encrypted(const struct inode *inode) #if IS_ENABLED(CONFIG_FS_ENCRYPTION) #if IS_ENABLED(CONFIG_CRYPTO_DISKCIPHER) if (inode && inode->i_crypt_info) - return (inode->i_crypt_info->ci_dtfm != NULL); + return S_ISREG(inode->i_mode) && (inode->i_crypt_info->ci_dtfm != NULL); #endif #endif return 0; diff --git a/fs/crypto/keyinfo.c b/fs/crypto/keyinfo.c index 794a28381b80..4a7920be7449 100644 --- a/fs/crypto/keyinfo.c +++ b/fs/crypto/keyinfo.c @@ -346,7 +346,7 @@ int fscrypt_get_encryption_info(struct inode *inode) } } /* clear diskcipher. use skcipher */ - pr_warn("%s: (inode %lu) fails to get diskcipher (%s, %d)\n", + pr_debug("%s: (inode %lu) fails to get diskcipher (%s, %d)\n", __func__, inode->i_ino, cipher_str, res); crypt_info->ci_dtfm = NULL; } diff --git a/fs/direct-io.c b/fs/direct-io.c index 4b5610f88024..cac8580510ed 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c @@ -449,7 +449,7 @@ static inline void dio_bio_submit(struct dio *dio, struct dio_submit *sdio) dio->refcount++; spin_unlock_irqrestore(&dio->bio_lock, flags); -#if defined(CONFIG_EXT4_FS_ENCRYPTION) && defined(CONFIG_CRYPTO_DISKCIPHER) +#if defined(CONFIG_CRYPTO_DISKCIPHER) if (dio->inode && fscrypt_has_encryption_key(dio->inode)) { fscrypt_set_bio(dio->inode, bio); crypto_diskcipher_debug(FS_DIO, bio->bi_opf); diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 295dab557e58..c0a350ec65c2 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -3833,9 +3833,11 @@ static ssize_t ext4_direct_IO(struct kiocb *iocb, struct iov_iter *iter) ssize_t ret; int rw = iov_iter_rw(iter); +#ifdef CONFIG_EXT4_FS_ENCRYPTION /* encrypt uses buffered-io for encryption, but, disk-encrypt can use direct-io */ if (ext4_encrypted_inode(inode) && S_ISREG(inode->i_mode) && !fscrypt_disk_encrypted(inode)) return 0; +#endif /* * If we are doing data journalling we don't support O_DIRECT */ diff --git a/include/linux/fscrypt_notsupp.h b/include/linux/fscrypt_notsupp.h index 7bae3b9fbc6c..7983547c97e7 100644 --- a/include/linux/fscrypt_notsupp.h +++ b/include/linux/fscrypt_notsupp.h @@ -216,7 +216,7 @@ static inline int __fscrypt_prepare_lookup(struct inode *dir, static inline int fscrypt_disk_encrypted(const struct inode *inode) { - return; + return 0; } static inline void fscrypt_set_bio(const struct inode *inode, struct bio *bio) -- 2.20.1