From: Yongpeng Yang Date: Mon, 21 Oct 2024 04:48:01 +0000 (+0800) Subject: f2fs: check curseg->inited before write_sum_page in change_curseg X-Git-Tag: v5.15.174~315 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4bd3d783be929a2f0622b1381e9810b3dd3f55a7;p=thirdparty%2Fkernel%2Fstable.git f2fs: check curseg->inited before write_sum_page in change_curseg [ Upstream commit 43563069e1c1df417d2eed6eca8a22fc6b04691d ] 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: 093749e296e2 ("f2fs: support age threshold based garbage collection") Signed-off-by: Yongpeng Yang Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 3e5900ddb92b0..0b284a28afeda 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -2737,7 +2737,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);