#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;
}
}
/* 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;
}
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);
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
*/
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)