lkml.org 
[lkml]   [2019]   [Jan]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH 17/19] btrfs: don't allow direct IO of encrypted extents
Date
Signed-off-by: Mark Harmstone <mark@harmstone.com>
---
fs/btrfs/inode.c | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index f8bc7174f7e3..8f58f492abc8 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -7945,6 +7945,17 @@ static int btrfs_get_blocks_direct(struct inode *inode, sector_t iblock,
goto unlock_err;
}

+ /*
+ * Fallback to buffered IO if we have an encrypted inode,
+ * as we would need to change what's in memory.
+ */
+ if ((create && inode_need_encrypt(inode)) ||
+ test_bit(EXTENT_FLAG_ENCRYPTED, &em->flags)) {
+ free_extent_map(em);
+ ret = -ENOTBLK;
+ goto unlock_err;
+ }
+
if (create) {
ret = btrfs_get_blocks_direct_write(&em, bh_result, inode,
dio_data, start, len);
--
2.19.2
\
 
 \ /
  Last update: 2019-01-09 02:28    [W:0.049 / U:0.168 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site