diff mbox

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

Message ID 1431477634-48111-2-git-send-email-jaegeuk@kernel.org (mailing list archive)
State New, archived
Headers show

Commit Message

Jaegeuk Kim May 13, 2015, 12:40 a.m. UTC
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@kernel.org>
---
 fs/f2fs/file.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox

Patch

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;