]> www.infradead.org Git - users/jedix/linux-maple.git/commit
f2fs: fix to wait page writeback before setting gcing flag
authorChao Yu <chao@kernel.org>
Mon, 12 Aug 2024 14:12:42 +0000 (22:12 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Wed, 21 Aug 2024 00:56:27 +0000 (00:56 +0000)
commita4d7f2b3238fd5f76b9e6434a0bd5d2e29049cff
treecc87a5cacdca630753fb58fd42784728df49f73d
parent8c1b787938fd86bab27a1492fa887408c75fec2b
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: 2d1fe8a86bf5 ("f2fs: fix to tag gcing flag on page during file defragment")
Fixes: 4961acdd65c9 ("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>
fs/f2fs/file.c