Skip to content

Commit 55fdc1c

Browse files
chaseyuJaegeuk Kim
authored andcommitted
f2fs: fix to wait on block writeback for post_read case
If inode is compressed, but not encrypted, it missed to call f2fs_wait_on_block_writeback() to wait for GCed page writeback in IPU write path. Thread A GC-Thread - f2fs_gc - do_garbage_collect - gc_data_segment - move_data_block - f2fs_submit_page_write migrate normal cluster's block via meta_inode's page cache - f2fs_write_single_data_page - f2fs_do_write_data_page - f2fs_inplace_write_data - f2fs_submit_page_bio IRQ - f2fs_read_end_io IRQ old data overrides new data due to out-of-order GC and common IO. - f2fs_read_end_io Fixes: 4c8ff70 ("f2fs: support data compression") Signed-off-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 parent 4961acd commit 55fdc1c

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

fs/f2fs/data.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2556,9 +2556,6 @@ int f2fs_encrypt_one_page(struct f2fs_io_info *fio)
25562556

25572557
page = fio->compressed_page ? fio->compressed_page : fio->page;
25582558

2559-
/* wait for GCed page writeback via META_MAPPING */
2560-
f2fs_wait_on_block_writeback(inode, fio->old_blkaddr);
2561-
25622559
if (fscrypt_inode_uses_inline_crypto(inode))
25632560
return 0;
25642561

@@ -2745,6 +2742,10 @@ int f2fs_do_write_data_page(struct f2fs_io_info *fio)
27452742
goto out_writepage;
27462743
}
27472744

2745+
/* wait for GCed page writeback via META_MAPPING */
2746+
if (fio->post_read)
2747+
f2fs_wait_on_block_writeback(inode, fio->old_blkaddr);
2748+
27482749
/*
27492750
* If current allocation needs SSR,
27502751
* it had better in-place writes for updated data.

0 commit comments

Comments
 (0)