diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2015-12-29 15:46:33 -0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2015-12-30 10:53:25 -0800 |
commit | 732d56489f21c04f7bf60c675f7d152c9239a09c (patch) | |
tree | a777f9d25457cbafac5399295b825c5ab9ed08d2 | |
parent | 4e0d836d5fb26d2cdbb75b0d16d98bef6b798490 (diff) | |
download | linux-732d56489f21c04f7bf60c675f7d152c9239a09c.tar.gz linux-732d56489f21c04f7bf60c675f7d152c9239a09c.tar.bz2 linux-732d56489f21c04f7bf60c675f7d152c9239a09c.zip |
f2fs: fix f2fs_ioc_abort_volatile_write
There are two rules to handle aborting volatile or atomic writes.
1. drop atomic writes
- we don't need to keep any stale db data.
2. write journal data
- we should keep the journal data with fsync for db recovery.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r-- | fs/f2fs/file.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 91f576a7903c..b04ab40ddc73 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -1433,9 +1433,14 @@ static int f2fs_ioc_abort_volatile_write(struct file *filp) if (ret) return ret; - clear_inode_flag(F2FS_I(inode), FI_ATOMIC_FILE); - clear_inode_flag(F2FS_I(inode), FI_VOLATILE_FILE); - commit_inmem_pages(inode, true); + if (f2fs_is_atomic_file(inode)) { + clear_inode_flag(F2FS_I(inode), FI_ATOMIC_FILE); + commit_inmem_pages(inode, true); + } + if (f2fs_is_volatile_file(inode)) { + clear_inode_flag(F2FS_I(inode), FI_VOLATILE_FILE); + ret = f2fs_sync_file(filp, 0, LLONG_MAX, 0); + } mnt_drop_write_file(filp); return ret; |