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>
This commit is contained in:
Chao Yu 2019-07-25 22:39:11 +08:00 committed by Jaegeuk Kim
parent fe973b065b
commit 038d06984f
1 changed files with 3 additions and 0 deletions

View File

@ -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;