From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757842AbdJMLRS (ORCPT ); Fri, 13 Oct 2017 07:17:18 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:8446 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753320AbdJMLRR (ORCPT ); Fri, 13 Oct 2017 07:17:17 -0400 Subject: Re: [f2fs-dev] [PATCH] f2fs: update dirty status for CURSEG as well To: Chao Yu , , , CC: , , , References: <1507728318-113117-1-git-send-email-yunlong.song@huawei.com> <19ac8324-6743-34bf-a670-d20fec2cfd7f@kernel.org> From: Yunlong Song Message-ID: <93303124-c68e-6092-03c1-82fd026d0344@huawei.com> Date: Fri, 13 Oct 2017 19:15:56 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <19ac8324-6743-34bf-a670-d20fec2cfd7f@kernel.org> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [10.111.220.140] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090204.59E0A0B0.0088,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: aceb7edbf6caafd4ba262ac2666188d6 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Correct, I will update the patch. On 2017/10/13 19:08, Chao Yu wrote: > Hi Yunlong, > > On 2017/10/11 21:25, Yunlong Song wrote: >> Without this patch, it will cause all the free segments using up in some >> corner case. For example, there are 100 segments, and 20 of them are >> reserved for ovp. If 79 segments are full of data, segment 80 becomes >> CURSEG segment, write 512 blocks and then delete 511 blocks. Since it is >> CURSEG segment, the __locate_dirty_segment will not update its dirty >> status. Then the dirty_segments(sbi) is 0, f2fs_gc will fail to >> get_victim, and f2fs_balance_fs will fail to trigger gc action. After >> f2fs_balance_fs returns, f2fs can continue to write data to segment 81. >> Again, segment 81 becomes CURSEG segment, write 512 blocks and delete >> 511 blocks, the dirty_segments(sbi) is 0 and f2fs_gc fail again. This >> can finally use up all the free segments and cause panic. > Should we also remove the check in locate_dirty_segment? > > Thanks, > >> Signed-off-by: Yunlong Song >> --- >> fs/f2fs/segment.c | 4 ---- >> 1 file changed, 4 deletions(-) >> >> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c >> index bfbcff8..0ff52d5 100644 >> --- a/fs/f2fs/segment.c >> +++ b/fs/f2fs/segment.c >> @@ -686,10 +686,6 @@ static void __locate_dirty_segment(struct f2fs_sb_info *sbi, unsigned int segno, >> { >> struct dirty_seglist_info *dirty_i = DIRTY_I(sbi); >> >> - /* need not be added */ >> - if (IS_CURSEG(sbi, segno)) >> - return; >> - >> if (!test_and_set_bit(segno, dirty_i->dirty_segmap[dirty_type])) >> dirty_i->nr_dirty[dirty_type]++; >> >> > . > -- Thanks, Yunlong Song