1 ext4: disable fallocate for encrypted inodes
3 From: Michael Halcrow <mhalcrow@google.com>
5 Signed-off-by: Michael Halcrow <mhalcrow@google.com>
6 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 fs/ext4/extents.c | 4 +++-
9 1 file changed, 3 insertions(+), 1 deletion(-)
11 diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
12 index 8170b32..5ee9675 100644
13 --- a/fs/ext4/extents.c
14 +++ b/fs/ext4/extents.c
15 @@ -4899,6 +4899,7 @@ out_mutex:
16 long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
18 struct inode *inode = file_inode(file);
19 + struct ext4_inode_info *ei = EXT4_I(inode);
21 unsigned int max_blocks;
23 @@ -4908,7 +4909,8 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
25 /* Return error if mode is not supported */
26 if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE |
27 - FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_ZERO_RANGE))
28 + FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_ZERO_RANGE) ||
29 + ext4_is_encryption_enabled(ei))
32 if (mode & FALLOC_FL_PUNCH_HOLE)