From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753467AbdJaCH4 (ORCPT ); Mon, 30 Oct 2017 22:07:56 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:9481 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751974AbdJaCHy (ORCPT ); Mon, 30 Oct 2017 22:07:54 -0400 Subject: Re: [PATCH v2] f2fs: collect prefree segments to avoild write checkpoint fail To: Chao Yu , , , CC: , , , , References: <1503748019-152845-1-git-send-email-yunlong.song@huawei.com> <1504267219-76575-1-git-send-email-yunlong.song@huawei.com> <6e9b8697-3340-6057-57e2-b98550e310a9@huawei.com> From: Yunlong Song Message-ID: Date: Tue, 31 Oct 2017 10:05:23 +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: <6e9b8697-3340-6057-57e2-b98550e310a9@huawei.com> 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.0A090206.59F7DAEC.0001,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: 2aead6e4ea12d8721fadebbbdee14c55 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org So I use CHECK_FS config to control it. When CHECK_FS is off, all the other f2fs_bug_on also only printk WARNING info rather than trigger BUG_ON. On 2017/10/31 9:59, Chao Yu wrote: > On 2017/10/31 9:33, Yunlong Song wrote: >> ping... >> >> On 2017/9/1 20:00, Yunlong Song wrote: >>> In come corner case, the reserved segments are used to do gc, and there are >>> not enough free segments for write checkpoint to finish its job, then the >>> gc process will fail to change the prefree segments to free segments. > I agreed to use this in production for robustness, but for upstream, it's better > to investigate and fix this issue rather than covering up it. > > Thanks, > >>> Signed-off-by: Yunlong Song >>> --- >>> fs/f2fs/gc.c | 10 ++++++++++ >>> 1 file changed, 10 insertions(+) >>> >>> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c >>> index cd147e7..6552b04 100644 >>> --- a/fs/f2fs/gc.c >>> +++ b/fs/f2fs/gc.c >>> @@ -1056,6 +1056,16 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, >>> if (!sync) { >>> if (has_not_enough_free_secs(sbi, sec_freed, 0)) { >>> segno = NULL_SEGNO; >>> +#ifndef CONFIG_F2FS_CHECK_FS >>> + if (prefree_segments(sbi) && >>> + has_not_enough_free_secs(sbi, >>> + reserved_sections(sbi), 0)) { >>> + ret = write_checkpoint(sbi, &cpc); >>> + if (ret) >>> + goto stop; >>> + sec_freed = 0; >>> + } >>> +#endif >>> goto gc_more; >>> } >>> > > . > -- Thanks, Yunlong Song