* [PATCH] f2fs: disallow direct IO in atomic write
@ 2019-07-25 14:39 Chao Yu
0 siblings, 0 replies; only message in thread
From: Chao Yu @ 2019-07-25 14:39 UTC (permalink / raw)
To: jaegeuk; +Cc: linux-f2fs-devel, linux-kernel, Chao Yu, Gao Xiang
From: Chao Yu <yuchao0@huawei.com>
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>
---
fs/f2fs/file.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 43d878f3db0f..34de73be2cc9 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1842,6 +1842,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;
--
2.22.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2019-07-25 14:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-25 14:39 [PATCH] f2fs: disallow direct IO in atomic write Chao Yu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).