summaryrefslogtreecommitdiffstats
path: root/fs/f2fs
diff options
context:
space:
mode:
authorDaeho Jeong <daehojeong@google.com>2020-10-12 06:59:47 +0200
committerJaegeuk Kim <jaegeuk@kernel.org>2020-10-14 08:23:34 +0200
commit8c8cf26ae302cb9dd47935f705945c985f7f5348 (patch)
treec5c2e386a611ebd31c9fb4cdfb0472fb274d528f /fs/f2fs
parentf2fs: introduce check_swap_activate_fast() (diff)
downloadlinux-8c8cf26ae302cb9dd47935f705945c985f7f5348.tar.xz
linux-8c8cf26ae302cb9dd47935f705945c985f7f5348.zip
f2fs: fix writecount false positive in releasing compress blocks
In current condition check, if it detects writecount, it return -EBUSY regardless of f_mode of the file. Fixed it. Signed-off-by: Daeho Jeong <daehojeong@google.com> Reviewed-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.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 62efbf1b2b62..7ceb6e30fc8c 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -3511,7 +3511,8 @@ static int f2fs_release_compress_blocks(struct file *filp, unsigned long arg)
inode_lock(inode);
writecount = atomic_read(&inode->i_writecount);
- if ((filp->f_mode & FMODE_WRITE && writecount != 1) || writecount) {
+ if ((filp->f_mode & FMODE_WRITE && writecount != 1) ||
+ (!(filp->f_mode & FMODE_WRITE) && writecount)) {
ret = -EBUSY;
goto out;
}