diff options
author | Kinglong Mee <kinglongmee@gmail.com> | 2017-03-10 17:54:52 +0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2017-03-21 22:34:29 -0400 |
commit | 46e82fb1b5349e75d8e64df40760f5f5a46bd80f (patch) | |
tree | c4b85c5249aab6df331e1e682210be33afe4feb5 | |
parent | 3cecfa5f6700c07ef943ab3d457f82f9868c4bfa (diff) | |
download | linux-stable-46e82fb1b5349e75d8e64df40760f5f5a46bd80f.tar.gz linux-stable-46e82fb1b5349e75d8e64df40760f5f5a46bd80f.tar.bz2 linux-stable-46e82fb1b5349e75d8e64df40760f5f5a46bd80f.zip |
f2fs: check new size by inode_newsize_ok in f2fs_insert_range
The inode_newsize_ok is better than only checking the maxbytes,
eg. the rlimit etc.
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r-- | fs/f2fs/file.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index cbde4d23e817..bc853dd9b7a3 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -1264,8 +1264,9 @@ static int f2fs_insert_range(struct inode *inode, loff_t offset, loff_t len) int ret = 0; new_size = i_size_read(inode) + len; - if (new_size > inode->i_sb->s_maxbytes) - return -EFBIG; + ret = inode_newsize_ok(inode, new_size); + if (ret) + return ret; if (offset >= i_size_read(inode)) return -EINVAL; |