diff options
author | Chao Yu <yuchao0@huawei.com> | 2019-07-22 05:57:05 -0400 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2019-08-23 10:57:11 -0400 |
commit | 955ebcd3a910b00de94be8797b20b8cfb2ee0fd8 (patch) | |
tree | 6ba43907487a20abbd5d2047acac98da78834185 /fs/f2fs | |
parent | 7975f3498dc0403d8177c0775b9514158ec66681 (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')
-rw-r--r-- | fs/f2fs/file.c | 11 | ||||
-rw-r--r-- | fs/f2fs/namei.c | 4 | ||||
-rw-r--r-- | fs/f2fs/xattr.c | 5 |
3 files changed, 20 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) | |||
56 | err = -EIO; | 56 | err = -EIO; |
57 | goto err; | 57 | goto err; |
58 | } | 58 | } |
59 | err = f2fs_is_checkpoint_ready(sbi); | ||
60 | if (err) | ||
61 | goto err; | ||
59 | 62 | ||
60 | sb_start_pagefault(inode->i_sb); | 63 | sb_start_pagefault(inode->i_sb); |
61 | 64 | ||
@@ -1567,6 +1570,9 @@ static long f2fs_fallocate(struct file *file, int mode, | |||
1567 | 1570 | ||
1568 | if (unlikely(f2fs_cp_error(F2FS_I_SB(inode)))) | 1571 | if (unlikely(f2fs_cp_error(F2FS_I_SB(inode)))) |
1569 | return -EIO; | 1572 | return -EIO; |
1573 | ret = f2fs_is_checkpoint_ready(F2FS_I_SB(inode)); | ||
1574 | if (ret) | ||
1575 | return ret; | ||
1570 | 1576 | ||
1571 | /* f2fs only support ->fallocate for regular file */ | 1577 | /* f2fs only support ->fallocate for regular file */ |
1572 | if (!S_ISREG(inode->i_mode)) | 1578 | if (!S_ISREG(inode->i_mode)) |
@@ -3062,8 +3068,13 @@ static int f2fs_ioc_resize_fs(struct file *filp, unsigned long arg) | |||
3062 | 3068 | ||
3063 | long f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | 3069 | long f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
3064 | { | 3070 | { |
3071 | int ret; | ||
3072 | |||
3065 | if (unlikely(f2fs_cp_error(F2FS_I_SB(file_inode(filp))))) | 3073 | if (unlikely(f2fs_cp_error(F2FS_I_SB(file_inode(filp))))) |
3066 | return -EIO; | 3074 | return -EIO; |
3075 | ret = f2fs_is_checkpoint_ready(F2FS_I_SB(file_inode(filp))); | ||
3076 | if (ret) | ||
3077 | return ret; | ||
3067 | 3078 | ||
3068 | switch (cmd) { | 3079 | switch (cmd) { |
3069 | case F2FS_IOC_GETFLAGS: | 3080 | case F2FS_IOC_GETFLAGS: |
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index 612561c4f7bd..7560c7ed38b1 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c | |||
@@ -801,9 +801,13 @@ out: | |||
801 | static int f2fs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) | 801 | static int f2fs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) |
802 | { | 802 | { |
803 | struct f2fs_sb_info *sbi = F2FS_I_SB(dir); | 803 | struct f2fs_sb_info *sbi = F2FS_I_SB(dir); |
804 | int ret; | ||
804 | 805 | ||
805 | if (unlikely(f2fs_cp_error(sbi))) | 806 | if (unlikely(f2fs_cp_error(sbi))) |
806 | return -EIO; | 807 | return -EIO; |
808 | ret = f2fs_is_checkpoint_ready(sbi); | ||
809 | if (ret) | ||
810 | return ret; | ||
807 | 811 | ||
808 | if (IS_ENCRYPTED(dir) || DUMMY_ENCRYPTION_ENABLED(sbi)) { | 812 | if (IS_ENCRYPTED(dir) || DUMMY_ENCRYPTION_ENABLED(sbi)) { |
809 | int err = fscrypt_get_encryption_info(dir); | 813 | int err = fscrypt_get_encryption_info(dir); |
diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c index b32c45621679..3c92f4122044 100644 --- a/fs/f2fs/xattr.c +++ b/fs/f2fs/xattr.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/posix_acl_xattr.h> | 21 | #include <linux/posix_acl_xattr.h> |
22 | #include "f2fs.h" | 22 | #include "f2fs.h" |
23 | #include "xattr.h" | 23 | #include "xattr.h" |
24 | #include "segment.h" | ||
24 | 25 | ||
25 | static int f2fs_xattr_generic_get(const struct xattr_handler *handler, | 26 | static int f2fs_xattr_generic_get(const struct xattr_handler *handler, |
26 | struct dentry *unused, struct inode *inode, | 27 | struct dentry *unused, struct inode *inode, |
@@ -729,6 +730,10 @@ int f2fs_setxattr(struct inode *inode, int index, const char *name, | |||
729 | struct f2fs_sb_info *sbi = F2FS_I_SB(inode); | 730 | struct f2fs_sb_info *sbi = F2FS_I_SB(inode); |
730 | int err; | 731 | int err; |
731 | 732 | ||
733 | err = f2fs_is_checkpoint_ready(sbi); | ||
734 | if (err) | ||
735 | return err; | ||
736 | |||
732 | err = dquot_initialize(inode); | 737 | err = dquot_initialize(inode); |
733 | if (err) | 738 | if (err) |
734 | return err; | 739 | return err; |