mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-07 01:45:18 +02:00
FROMGIT: f2fs: fix to wait page writeback before setting gcing flag
Soft IRQ Thread - f2fs_write_end_io - f2fs_defragment_range - set_page_private_gcing - type = WB_DATA_TYPE(page, false); : assign type w/ F2FS_WB_CP_DATA due to page_private_gcing() is true - dec_page_count() w/ wrong type - end_page_writeback() Value of F2FS_WB_CP_DATA reference count may become negative under above race condition, the root cause is we missed to wait page writeback before setting gcing page private flag, let's fix it. Fixes:2d1fe8a86b
("f2fs: fix to tag gcing flag on page during file defragment") Fixes:4961acdd65
("f2fs: fix to tag gcing flag on page during block migration") Signed-off-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> Bug: 353929868 (cherry picked from commita4d7f2b323
https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git/ dev) Change-Id: I84a56ccf3308a6789ab979ed5a230a37b3594a66 Signed-off-by: zhoumaowei <zhoumaowei@oppo.com>
This commit is contained in:
parent
63aeacfc81
commit
3fb778c361
|
@ -2800,6 +2800,8 @@ do_map:
|
|||
goto clear_out;
|
||||
}
|
||||
|
||||
f2fs_wait_on_page_writeback(page, DATA, true, true);
|
||||
|
||||
set_page_dirty(page);
|
||||
set_page_private_gcing(page);
|
||||
f2fs_put_page(page, 1);
|
||||
|
@ -4200,6 +4202,8 @@ static int redirty_blocks(struct inode *inode, pgoff_t page_idx, int len)
|
|||
/* It will never fail, when page has pinned above */
|
||||
f2fs_bug_on(F2FS_I_SB(inode), !page);
|
||||
|
||||
f2fs_wait_on_page_writeback(page, DATA, true, true);
|
||||
|
||||
set_page_dirty(page);
|
||||
set_page_private_gcing(page);
|
||||
f2fs_put_page(page, 1);
|
||||
|
|
Loading…
Reference in New Issue
Block a user