]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
f2fs: check curseg->inited before write_sum_page in change_curseg
authorYongpeng Yang <yangyongpeng1@oppo.com>
Mon, 21 Oct 2024 04:48:01 +0000 (12:48 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2024 12:53:49 +0000 (13:53 +0100)
[ 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 <yangyongpeng1@oppo.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/f2fs/segment.c

index 3f49a9e0ec642c5bb032996568c5f39022a32da1..6379d9c40a024379d7cec421a5b9a5259f8bc3e2 100644 (file)
@@ -2926,7 +2926,8 @@ static int 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);