[PATCH 2/6] f2fs crypto: not support fcollapse for encrypted inode

From: Jaegeuk Kim
Date: Tue May 12 2015 - 20:40:56 EST


The fcollapse replaces block addresses without IOs, but this violates
encryption rule in which each block is encrypted with its block offset.

Signed-off-by: Jaegeuk Kim <jaegeuk@xxxxxxxxxx>
---
fs/f2fs/file.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 57f9a02..c4f9c08 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1081,6 +1081,9 @@ static long f2fs_fallocate(struct file *file, int mode,
struct inode *inode = file_inode(file);
long ret = 0;

+ if (f2fs_encrypted_inode(inode) && (mode & FALLOC_FL_COLLAPSE_RANGE))
+ return -EOPNOTSUPP;
+
if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE |
FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_ZERO_RANGE))
return -EOPNOTSUPP;
--
2.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/