f2fs: avoid data race between FI_DIRTY_INODE flag and update_inode
authorJaegeuk Kim <jaegeuk@kernel.org>
Thu, 2 Jun 2016 21:15:56 +0000 (14:15 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 7 Jun 2016 16:45:40 +0000 (09:45 -0700)
commit1e7c48fa9a34556639328d50780d12a304e0bb6d
tree9a974e4a957ecd15d9d87888e673fe0d6b864f6f
parent9a449e9c3b34ef3f7029bd966f98cbbfccd144e5
f2fs: avoid data race between FI_DIRTY_INODE flag and update_inode

FI_DIRTY_INODE flag is not covered by inode page lock, so it can be unset
at any time like below.

Thread #1                        Thread #2
- lock_page(ipage)
- update i_fields
                                 - update i_size/i_blocks/and so on
 - set FI_DIRTY_INODE
- reset FI_DIRTY_INODE
- set_page_dirty(ipage)

In this case, we can lose the latest i_field information.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/inode.c