Skip to content

Commit

Permalink
f2fs: check curseg->inited before write_sum_page in change_curseg
Browse files Browse the repository at this point in the history
[ Upstream commit 4356306 ]

In the __f2fs_init_atgc_curseg->get_atssr_segment calling,
curseg->segno is NULL_SEGNO, indicating that there is no summary
block that needs to be written.

Fixes: 093749e ("f2fs: support age threshold based garbage collection")
Signed-off-by: Yongpeng Yang <[email protected]>
Reviewed-by: Chao Yu <[email protected]>
Signed-off-by: Jaegeuk Kim <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
Yongpeng Yang authored and gregkh committed Dec 9, 2024
1 parent f3d586b commit 67f4c66
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/f2fs/segment.c
Original file line number Diff line number Diff line change
Expand Up @@ -2848,7 +2848,8 @@ static void change_curseg(struct f2fs_sb_info *sbi, int type)
struct f2fs_summary_block *sum_node;
struct page *sum_page;

write_sum_page(sbi, curseg->sum_blk, GET_SUM_BLOCK(sbi, curseg->segno));
if (curseg->inited)
write_sum_page(sbi, curseg->sum_blk, GET_SUM_BLOCK(sbi, curseg->segno));

__set_test_and_inuse(sbi, new_segno);

Expand Down

0 comments on commit 67f4c66

Please sign in to comment.