Skip to content

Commit 3611ce9

Browse files
Yunlong SongJaegeuk Kim
authored andcommitted
f2fs: do not set free of current section
For the case when sbi->segs_per_sec > 1, take section:segment = 5 for example, if segment 1 is just used and allocate new segment 2, and the blocks of segment 1 is invalidated, at this time, the previous code will use __set_test_and_free to free the free_secmap and free_sections++, this is not correct since it is still a current section, so fix it. Signed-off-by: Yunlong Song <[email protected]> Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent 36b877a commit 3611ce9

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

fs/f2fs/segment.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,13 +448,16 @@ static inline void __set_test_and_free(struct f2fs_sb_info *sbi,
448448
if (test_and_clear_bit(segno, free_i->free_segmap)) {
449449
free_i->free_segments++;
450450

451+
if (IS_CURSEC(sbi, secno))
452+
goto skip_free;
451453
next = find_next_bit(free_i->free_segmap,
452454
start_segno + sbi->segs_per_sec, start_segno);
453455
if (next >= start_segno + sbi->segs_per_sec) {
454456
if (test_and_clear_bit(secno, free_i->free_secmap))
455457
free_i->free_sections++;
456458
}
457459
}
460+
skip_free:
458461
spin_unlock(&free_i->segmap_lock);
459462
}
460463

0 commit comments

Comments
 (0)