summaryrefslogtreecommitdiff
path: root/fs/f2fs/file.c
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2019-07-22 17:57:05 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2019-08-23 07:57:11 -0700
commit955ebcd3a910b00de94be8797b20b8cfb2ee0fd8 (patch)
tree6ba43907487a20abbd5d2047acac98da78834185 /fs/f2fs/file.c
parent7975f3498dc0403d8177c0775b9514158ec66681 (diff)
f2fs: fix to spread f2fs_is_checkpoint_ready()
We missed to call f2fs_is_checkpoint_ready() in several places, it may allow space allocation even when free space was exhausted during checkpoint is disabled, fix to add them. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/file.c')
-rw-r--r--fs/f2fs/file.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 3e58a6f697dd..1e27b4bc852d 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -56,6 +56,9 @@ static vm_fault_t f2fs_vm_page_mkwrite(struct vm_fault *vmf)
err = -EIO;
goto err;
}
+ err = f2fs_is_checkpoint_ready(sbi);
+ if (err)
+ goto err;
sb_start_pagefault(inode->i_sb);
@@ -1567,6 +1570,9 @@ static long f2fs_fallocate(struct file *file, int mode,
if (unlikely(f2fs_cp_error(F2FS_I_SB(inode))))
return -EIO;
+ ret = f2fs_is_checkpoint_ready(F2FS_I_SB(inode));
+ if (ret)
+ return ret;
/* f2fs only support ->fallocate for regular file */
if (!S_ISREG(inode->i_mode))
@@ -3062,8 +3068,13 @@ static int f2fs_ioc_resize_fs(struct file *filp, unsigned long arg)
long f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
+ int ret;
+
if (unlikely(f2fs_cp_error(F2FS_I_SB(file_inode(filp)))))
return -EIO;
+ ret = f2fs_is_checkpoint_ready(F2FS_I_SB(file_inode(filp)));
+ if (ret)
+ return ret;
switch (cmd) {
case F2FS_IOC_GETFLAGS: