-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Commit 902507d
f2fs: fix to data block override node segment by mistake
[ Upstream commit a0770e1 ]
v4: Rearrange the previous three versions.
The following scenario could lead to data block override by mistake.
TASK A | TASK kworker | TASK B | TASK C
| | |
open | | |
write | | |
close | | |
| f2fs_write_data_pages | |
| f2fs_write_cache_pages | |
| f2fs_outplace_write_data | |
| f2fs_allocate_data_block (get block in seg S, | |
| S is full, and only | |
| have this valid data | |
| block) | |
| allocate_segment | |
| locate_dirty_segment (mark S as PRE) | |
| f2fs_submit_page_write (submit but is not | |
| written on dev) | |
unlink | | |
iput_final | | |
f2fs_drop_inode | | |
f2fs_truncate | | |
(not evict) | | |
| | write_checkpoint |
| | flush merged bio but not wait file data writeback |
| | set_prefree_as_free (mark S as FREE) |
| | | update NODE/DATA
| | | allocate_segment (select S)
| writeback done | |
So we need to guarantee io complete before truncate inode in f2fs_drop_inode.
Reviewed-by: Chao Yu <[email protected]>
Signed-off-by: Zheng Liang <[email protected]>
Signed-off-by: Jaegeuk Kim <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>1 parent 3667215 commit 902507dCopy full SHA for 902507d
File tree
Expand file treeCollapse file tree
1 file changed
+4
-0
lines changedFilter options
- fs/f2fs
Expand file treeCollapse file tree
1 file changed
+4
-0
lines changed+4Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
915 | 915 |
| |
916 | 916 |
| |
917 | 917 |
| |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
918 | 922 |
| |
919 | 923 |
| |
920 | 924 |
| |
|
0 commit comments