diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2022-01-07 20:08:45 -0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2022-01-10 09:05:09 -0800 |
commit | 5fed0be8583f08c1548b4dcd9e5ee0d1133d0730 (patch) | |
tree | 8c6af26416c59c8b49864643d94cecd55dbe185d /fs/f2fs/file.c | |
parent | 2b642898e5ea206d04684e55235878ea3425659c (diff) | |
download | linux-stable-5fed0be8583f08c1548b4dcd9e5ee0d1133d0730.tar.gz linux-stable-5fed0be8583f08c1548b4dcd9e5ee0d1133d0730.tar.bz2 linux-stable-5fed0be8583f08c1548b4dcd9e5ee0d1133d0730.zip |
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>
Diffstat (limited to 'fs/f2fs/file.c')
-rw-r--r-- | fs/f2fs/file.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index f540c1cbddca..3c98ef6af97d 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -1750,7 +1750,11 @@ static long f2fs_fallocate(struct file *file, int mode, (mode & (FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_INSERT_RANGE))) 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 | FALLOC_FL_ZERO_RANGE | FALLOC_FL_INSERT_RANGE))) return -EOPNOTSUPP; |