]> git.baikalelectronics.ru Git - kernel.git/commit
f2fs: Fix indefinite loop in f2fs_gc()
authorSahitya Tummala <stummala@codeaurora.org>
Mon, 29 Jul 2019 05:20:26 +0000 (10:50 +0530)
committerJaegeuk Kim <jaegeuk@kernel.org>
Mon, 9 Sep 2019 12:06:11 +0000 (13:06 +0100)
commit615bb0604031d824f754cfd25955b558bf08367d
treea58f58dbf5ce86e54f670308baa03326abcb2d8b
parenteddca63d62c6dc02c7dad36d4b40f58b1b1c82b0
f2fs: Fix indefinite loop in f2fs_gc()

Policy - foreground GC, LFS mode and greedy GC mode.

Under this policy, f2fs_gc() loops forever to GC as it doesn't have
enough free segements to proceed and thus it keeps calling gc_more
for the same victim segment.  This can happen if the selected victim
segment could not be GC'd due to failed blkaddr validity check i.e.
is_alive() returns false for the blocks set in current validity map.

Fix this by not resetting the sbi->cur_victim_sec to NULL_SEGNO, when
the segment selected could not be GC'd. This helps to select another
segment for GC and thus helps to proceed forward with GC.

[Note]
This can happen due to is_alive as well as atomic_file which skipps
GC.

Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/gc.c