[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20190725143911.28468-1-chao@kernel.org>
Date: Thu, 25 Jul 2019 22:39:11 +0800
From: Chao Yu <chao@...nel.org>
To: jaegeuk@...nel.org
Cc: linux-f2fs-devel@...ts.sourceforge.net,
linux-kernel@...r.kernel.org, Chao Yu <yuchao0@...wei.com>,
Gao Xiang <gaoxiang25@...wei.com>
Subject: [PATCH] f2fs: disallow direct IO in atomic write
From: Chao Yu <yuchao0@...wei.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@...wei.com>
Signed-off-by: Chao Yu <yuchao0@...wei.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
Powered by blists - more mailing lists