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>
err = -EIO;
goto err;
}
+ err = f2fs_is_checkpoint_ready(sbi);
+ if (err)
+ goto err;
sb_start_pagefault(inode->i_sb);
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))
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:
static int f2fs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
{
struct f2fs_sb_info *sbi = F2FS_I_SB(dir);
+ int ret;
if (unlikely(f2fs_cp_error(sbi)))
return -EIO;
+ ret = f2fs_is_checkpoint_ready(sbi);
+ if (ret)
+ return ret;
if (IS_ENCRYPTED(dir) || DUMMY_ENCRYPTION_ENABLED(sbi)) {
int err = fscrypt_get_encryption_info(dir);
#include <linux/posix_acl_xattr.h>
#include "f2fs.h"
#include "xattr.h"
+#include "segment.h"
static int f2fs_xattr_generic_get(const struct xattr_handler *handler,
struct dentry *unused, struct inode *inode,
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
int err;
+ err = f2fs_is_checkpoint_ready(sbi);
+ if (err)
+ return err;
+
err = dquot_initialize(inode);
if (err)
return err;