]> git.baikalelectronics.ru Git - kernel.git/commit
f2fs: fix to clear FI_VOLATILE_FILE correctly
authorChao Yu <yuchao0@huawei.com>
Mon, 4 Jun 2018 15:20:51 +0000 (23:20 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Mon, 4 Jun 2018 21:33:27 +0000 (14:33 -0700)
commit42649fc44bfc6f1980cd5c0a56104491d375514d
tree59a2825a37a0c70f9112515d5480d7ffe26ad907
parentea21ed04c1b2678cbf3e22df3be8352f04e89dbe
f2fs: fix to clear FI_VOLATILE_FILE correctly

Thread A Thread B
- f2fs_release_file
 - clear_inode_flag(FI_VOLATILE_FILE)
- wb_writeback
 - writeback_sb_inodes
  - __writeback_single_inode
   - do_writepages
    - f2fs_write_data_pages
     - __write_data_page
     all volatile file's pages
     are writebacked to storage
 - set_inode_flag(FI_DROP_CACHE)
 - filemap_fdatawrite

There is a hole that mm can flush all dirty pages of volatile file as
inode is not tagged with both FI_VOLATILE_FILE and FI_DROP_CACHE flags,
we should never writeback the page #0 and also it's unneeded to writeback
other pages.

This patch adjusts to relocate clear_inode_flag(FI_VOLATILE_FILE), so that
FI_VOLATILE_FILE flag can be remained before all dirty pages were dropped
to avoid issue.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/file.c