forked from Minki/linux
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: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
a5f64b6aa6
commit
f4c9c743ac
@ -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)
|
static int f2fs_ioc_start_atomic_write(struct file *filp)
|
||||||
{
|
{
|
||||||
struct inode *inode = file_inode(filp);
|
struct inode *inode = file_inode(filp);
|
||||||
|
int ret;
|
||||||
|
|
||||||
if (!inode_owner_or_capable(inode))
|
if (!inode_owner_or_capable(inode))
|
||||||
return -EACCES;
|
return -EACCES;
|
||||||
@ -1332,9 +1333,12 @@ static int f2fs_ioc_start_atomic_write(struct file *filp)
|
|||||||
if (f2fs_is_atomic_file(inode))
|
if (f2fs_is_atomic_file(inode))
|
||||||
return 0;
|
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)
|
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)
|
static int f2fs_ioc_start_volatile_write(struct file *filp)
|
||||||
{
|
{
|
||||||
struct inode *inode = file_inode(filp);
|
struct inode *inode = file_inode(filp);
|
||||||
|
int ret;
|
||||||
|
|
||||||
if (!inode_owner_or_capable(inode))
|
if (!inode_owner_or_capable(inode))
|
||||||
return -EACCES;
|
return -EACCES;
|
||||||
@ -1372,9 +1377,12 @@ static int f2fs_ioc_start_volatile_write(struct file *filp)
|
|||||||
if (f2fs_is_volatile_file(inode))
|
if (f2fs_is_volatile_file(inode))
|
||||||
return 0;
|
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)
|
static int f2fs_ioc_release_volatile_write(struct file *filp)
|
||||||
|
Loading…
Reference in New Issue
Block a user