Skip to content

Commit 5fed0be

Browse files
author
Jaegeuk Kim
committed
f2fs: do not allow partial truncation on pinned file
If the pinned file has a hole by partial truncation, application that has the block map will be broken. Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent 2b64289 commit 5fed0be

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fs/f2fs/file.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1750,7 +1750,11 @@ static long f2fs_fallocate(struct file *file, int mode,
17501750
(mode & (FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_INSERT_RANGE)))
17511751
return -EOPNOTSUPP;
17521752

1753-
if (f2fs_compressed_file(inode) &&
1753+
/*
1754+
* Pinned file should not support partial trucation since the block
1755+
* can be used by applications.
1756+
*/
1757+
if ((f2fs_compressed_file(inode) || f2fs_is_pinned_file(inode)) &&
17541758
(mode & (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_COLLAPSE_RANGE |
17551759
FALLOC_FL_ZERO_RANGE | FALLOC_FL_INSERT_RANGE)))
17561760
return -EOPNOTSUPP;

0 commit comments

Comments
 (0)