[PATCH 2/2] f2fs: don't allow atomic writes for not regular files

From: Jaegeuk Kim
Date: Thu Mar 16 2017 - 22:16:45 EST


The atomic writes only supports regular files for database.

Signed-off-by: Jaegeuk Kim <jaegeuk@xxxxxxxxxx>
---
fs/f2fs/file.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index da6d33d1bb34..d486e02b43c2 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1522,6 +1522,9 @@ static int f2fs_ioc_start_atomic_write(struct file *filp)
if (f2fs_is_atomic_file(inode))
goto out;

+ if (!S_ISREG(inode->i_mode))
+ return -EINVAL;
+
ret = f2fs_convert_inline_inode(inode);
if (ret)
goto out;
--
2.11.0