mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] f2fs: collect prefree segments to avoild write checkpoint fail
@ 2017-08-26 11:46 Yunlong Song
  2017-08-28  9:52 ` Chao Yu
  2017-09-01 12:00 ` [PATCH v2] " Yunlong Song
  0 siblings, 2 replies; 7+ messages in thread
From: Yunlong Song @ 2017-08-26 11:46 UTC (permalink / raw)
  To: jaegeuk, chao, yuchao0, yunlong.song, yunlong.song
  Cc: miaoxie, bintian.wang, linux-fsdevel, linux-f2fs-devel, linux-kernel

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.

Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
---
 fs/f2fs/gc.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index cd147e7..c8a828f 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -1056,6 +1056,13 @@ 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;
+			if (prefree_segments(sbi) &&
+				has_not_enough_free_secs(sbi,
+					reserved_sections(sbi), 0)) {
+				ret = write_checkpoint(sbi, &cpc);
+				if (ret)
+					goto stop;
+			}
 			goto gc_more;
 		}
 
-- 
1.8.5.2

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] f2fs: collect prefree segments to avoild write checkpoint fail
  2017-08-26 11:46 [PATCH] f2fs: collect prefree segments to avoild write checkpoint fail Yunlong Song
@ 2017-08-28  9:52 ` Chao Yu
  2017-09-01 12:00 ` [PATCH v2] " Yunlong Song
  1 sibling, 0 replies; 7+ messages in thread
From: Chao Yu @ 2017-08-28  9:52 UTC (permalink / raw)
  To: Yunlong Song, jaegeuk, chao, yunlong.song
  Cc: miaoxie, bintian.wang, linux-fsdevel, linux-f2fs-devel, linux-kernel

Hi Yunlong,

On 2017/8/26 19:46, 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.

How about doing investigate that why we haven't enough free segment for GC?

Thanks,

> 
> Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
> ---
>  fs/f2fs/gc.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
> index cd147e7..c8a828f 100644
> --- a/fs/f2fs/gc.c
> +++ b/fs/f2fs/gc.c
> @@ -1056,6 +1056,13 @@ 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;
> +			if (prefree_segments(sbi) &&
> +				has_not_enough_free_secs(sbi,
> +					reserved_sections(sbi), 0)) {
> +				ret = write_checkpoint(sbi, &cpc);
> +				if (ret)
> +					goto stop;
> +			}
>  			goto gc_more;
>  		}
>  
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2] f2fs: collect prefree segments to avoild write checkpoint fail
  2017-08-26 11:46 [PATCH] f2fs: collect prefree segments to avoild write checkpoint fail Yunlong Song
  2017-08-28  9:52 ` Chao Yu
@ 2017-09-01 12:00 ` Yunlong Song
  2017-10-31  1:33   ` Yunlong Song
  1 sibling, 1 reply; 7+ messages in thread
From: Yunlong Song @ 2017-09-01 12:00 UTC (permalink / raw)
  To: jaegeuk, chao, yuchao0, yunlong.song, yunlong.song
  Cc: miaoxie, bintian.wang, linux-fsdevel, linux-f2fs-devel, linux-kernel

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.

Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
---
 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;
 		}
 
-- 
1.8.5.2

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] f2fs: collect prefree segments to avoild write checkpoint fail
  2017-09-01 12:00 ` [PATCH v2] " Yunlong Song
@ 2017-10-31  1:33   ` Yunlong Song
  2017-10-31  1:59     ` Chao Yu
  0 siblings, 1 reply; 7+ messages in thread
From: Yunlong Song @ 2017-10-31  1:33 UTC (permalink / raw)
  To: jaegeuk, chao, yuchao0, yunlong.song
  Cc: miaoxie, bintian.wang, linux-fsdevel, linux-f2fs-devel, linux-kernel

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.
>
> Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
> ---
>   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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] f2fs: collect prefree segments to avoild write checkpoint fail
  2017-10-31  1:33   ` Yunlong Song
@ 2017-10-31  1:59     ` Chao Yu
  2017-10-31  2:05       ` Yunlong Song
  0 siblings, 1 reply; 7+ messages in thread
From: Chao Yu @ 2017-10-31  1:59 UTC (permalink / raw)
  To: Yunlong Song, jaegeuk, chao, yunlong.song
  Cc: miaoxie, bintian.wang, linux-fsdevel, linux-f2fs-devel, linux-kernel

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 <yunlong.song@huawei.com>
>> ---
>>   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;
>>   		}
>>   
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] f2fs: collect prefree segments to avoild write checkpoint fail
  2017-10-31  1:59     ` Chao Yu
@ 2017-10-31  2:05       ` Yunlong Song
  2017-10-31  2:56         ` Chao Yu
  0 siblings, 1 reply; 7+ messages in thread
From: Yunlong Song @ 2017-10-31  2:05 UTC (permalink / raw)
  To: Chao Yu, jaegeuk, chao, yunlong.song
  Cc: miaoxie, bintian.wang, linux-fsdevel, linux-f2fs-devel, linux-kernel

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 <yunlong.song@huawei.com>
>>> ---
>>>    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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] f2fs: collect prefree segments to avoild write checkpoint fail
  2017-10-31  2:05       ` Yunlong Song
@ 2017-10-31  2:56         ` Chao Yu
  0 siblings, 0 replies; 7+ messages in thread
From: Chao Yu @ 2017-10-31  2:56 UTC (permalink / raw)
  To: Yunlong Song, jaegeuk, chao, yunlong.song
  Cc: miaoxie, bintian.wang, linux-fsdevel, linux-f2fs-devel, linux-kernel

On 2017/10/31 10:05, Yunlong Song wrote:
> 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.

If this runing out-of-free-segments issue explicitly happens, IMO, its better
to face and fix it.

BTW, it's better to add bug_on here to detect the issue?

Thanks,

> 
> 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 <yunlong.song@huawei.com>
>>>> ---
>>>>    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;
>>>>    		}
>>>>    
>>
>> .
>>
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-10-31  3:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-26 11:46 [PATCH] f2fs: collect prefree segments to avoild write checkpoint fail Yunlong Song
2017-08-28  9:52 ` Chao Yu
2017-09-01 12:00 ` [PATCH v2] " Yunlong Song
2017-10-31  1:33   ` Yunlong Song
2017-10-31  1:59     ` Chao Yu
2017-10-31  2:05       ` Yunlong Song
2017-10-31  2:56         ` Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®