Commit f4c9c743 authored by Chao Yu's avatar Chao Yu Committed by Jaegeuk Kim

f2fs: convert inline data before set atomic/volatile flag

In f2fs_ioc_start_{atomic,volatile}_write, if we failed in converting
inline data, we will report error to user, but still remain atomic/volatile
flag in inode, it will impact further writes for this file. Fix it.
Signed-off-by: default avatarChao Yu <chao2.yu@samsung.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent a5f64b6a
......@@ -1323,6 +1323,7 @@ static int f2fs_ioc_getversion(struct file *filp, unsigned long arg)
static int f2fs_ioc_start_atomic_write(struct file *filp)
{
struct inode *inode = file_inode(filp);
int ret;
if (!inode_owner_or_capable(inode))
return -EACCES;
......@@ -1332,9 +1333,12 @@ static int f2fs_ioc_start_atomic_write(struct file *filp)
if (f2fs_is_atomic_file(inode))
return 0;
set_inode_flag(F2FS_I(inode), FI_ATOMIC_FILE);
ret = f2fs_convert_inline_inode(inode);
if (ret)
return ret;
return f2fs_convert_inline_inode(inode);
set_inode_flag(F2FS_I(inode), FI_ATOMIC_FILE);
return 0;
}
static int f2fs_ioc_commit_atomic_write(struct file *filp)
......@@ -1365,6 +1369,7 @@ static int f2fs_ioc_commit_atomic_write(struct file *filp)
static int f2fs_ioc_start_volatile_write(struct file *filp)
{
struct inode *inode = file_inode(filp);
int ret;
if (!inode_owner_or_capable(inode))
return -EACCES;
......@@ -1372,9 +1377,12 @@ static int f2fs_ioc_start_volatile_write(struct file *filp)
if (f2fs_is_volatile_file(inode))
return 0;
set_inode_flag(F2FS_I(inode), FI_VOLATILE_FILE);
ret = f2fs_convert_inline_inode(inode);
if (ret)
return ret;
return f2fs_convert_inline_inode(inode);
set_inode_flag(F2FS_I(inode), FI_VOLATILE_FILE);
return 0;
}
static int f2fs_ioc_release_volatile_write(struct file *filp)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment