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 <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
2b642898e5
commit
5fed0be858
1 changed files with 5 additions and 1 deletions
|
@ -1750,7 +1750,11 @@ static long f2fs_fallocate(struct file *file, int mode,
|
||||||
(mode & (FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_INSERT_RANGE)))
|
(mode & (FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_INSERT_RANGE)))
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
if (f2fs_compressed_file(inode) &&
|
/*
|
||||||
|
* Pinned file should not support partial trucation since the block
|
||||||
|
* can be used by applications.
|
||||||
|
*/
|
||||||
|
if ((f2fs_compressed_file(inode) || f2fs_is_pinned_file(inode)) &&
|
||||||
(mode & (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_COLLAPSE_RANGE |
|
(mode & (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_COLLAPSE_RANGE |
|
||||||
FALLOC_FL_ZERO_RANGE | FALLOC_FL_INSERT_RANGE)))
|
FALLOC_FL_ZERO_RANGE | FALLOC_FL_INSERT_RANGE)))
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
|
|
Loading…
Add table
Reference in a new issue