Skip to content

Commit 803e74b

Browse files
author
Jaegeuk Kim
committed
f2fs: stop GC when the victim becomes fully valid
We must stop GC, once the segment becomes fully valid. Otherwise, it can produce another dirty segments by moving valid blocks in the segment partially. Ramon hit no free segment panic sometimes and saw this case happens when validating reliable file pinning feature. Signed-off-by: Ramon Pantin <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent a4db59a commit 803e74b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

fs/f2fs/gc.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,8 +1012,14 @@ static int gc_data_segment(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,
10121012
block_t start_bidx;
10131013
nid_t nid = le32_to_cpu(entry->nid);
10141014

1015-
/* stop BG_GC if there is not enough free sections. */
1016-
if (gc_type == BG_GC && has_not_enough_free_secs(sbi, 0, 0))
1015+
/*
1016+
* stop BG_GC if there is not enough free sections.
1017+
* Or, stop GC if the segment becomes fully valid caused by
1018+
* race condition along with SSR block allocation.
1019+
*/
1020+
if ((gc_type == BG_GC && has_not_enough_free_secs(sbi, 0, 0)) ||
1021+
get_valid_blocks(sbi, segno, false) ==
1022+
sbi->blocks_per_seg)
10171023
return submitted;
10181024

10191025
if (check_valid_map(sbi, segno, off) == 0)

0 commit comments

Comments
 (0)