summaryrefslogtreecommitdiff
path: root/fs/f2fs/file.c
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2019-07-25 22:39:11 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2019-08-23 07:57:12 -0700
commit038d06984f5c50a101c1cf47bc6419064042716d (patch)
tree28a98c49b345d8d1326688afc4a67f0f8ad03ad3 /fs/f2fs/file.c
parentfe973b065bce0e61414c33251afae501a757f8c6 (diff)
f2fs: disallow direct IO in atomic write
Atomic write needs page cache to cache data of transaction, direct IO should never be allowed in atomic write, detect and deny it when open atomic write file. Signed-off-by: Gao Xiang <gaoxiang25@huawei.com> 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.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 1e27b4bc852d..a5080bea6b0b 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1825,6 +1825,9 @@ static int f2fs_ioc_start_atomic_write(struct file *filp)
if (!S_ISREG(inode->i_mode))
return -EINVAL;
+ if (filp->f_flags & O_DIRECT)
+ return -EINVAL;
+
ret = mnt_want_write_file(filp);
if (ret)
return ret;