Linux-f2fs-devel Archive on lore.kernel.org
 help / color / Atom feed
* [f2fs-dev] [PATCH] f2fs: don't skip writeback of quota data
@ 2020-07-09  5:30 Jaegeuk Kim
  2020-07-09  7:10 ` Chao Yu
  0 siblings, 1 reply; 15+ messages in thread
From: Jaegeuk Kim @ 2020-07-09  5:30 UTC (permalink / raw)
  To: linux-kernel, linux-f2fs-devel, kernel-team; +Cc: Jaegeuk Kim

It doesn't need to bypass flushing quota data in background.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fs/f2fs/data.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 44645f4f914b6..72e8b50e588c1 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -3148,7 +3148,7 @@ static int __f2fs_write_data_pages(struct address_space *mapping,
 	if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING)))
 		goto skip_write;
 
-	if ((S_ISDIR(inode->i_mode) || IS_NOQUOTA(inode)) &&
+	if (S_ISDIR(inode->i_mode) &&
 			wbc->sync_mode == WB_SYNC_NONE &&
 			get_dirty_pages(inode) < nr_pages_to_skip(sbi, DATA) &&
 			f2fs_available_free_memory(sbi, DIRTY_DENTS))
-- 
2.27.0.383.g050319c2ae-goog



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH] f2fs: don't skip writeback of quota data
  2020-07-09  5:30 [f2fs-dev] [PATCH] f2fs: don't skip writeback of quota data Jaegeuk Kim
@ 2020-07-09  7:10 ` Chao Yu
  2020-07-09 19:05   ` Jaegeuk Kim
  0 siblings, 1 reply; 15+ messages in thread
From: Chao Yu @ 2020-07-09  7:10 UTC (permalink / raw)
  To: Jaegeuk Kim, linux-kernel, linux-f2fs-devel, kernel-team

On 2020/7/9 13:30, Jaegeuk Kim wrote:
> It doesn't need to bypass flushing quota data in background.

The condition is used to flush quota data in batch to avoid random
small-sized udpate, did you hit any problem here?

Thanks,

> 
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
>  fs/f2fs/data.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index 44645f4f914b6..72e8b50e588c1 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -3148,7 +3148,7 @@ static int __f2fs_write_data_pages(struct address_space *mapping,
>  	if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING)))
>  		goto skip_write;
>  
> -	if ((S_ISDIR(inode->i_mode) || IS_NOQUOTA(inode)) &&
> +	if (S_ISDIR(inode->i_mode) &&
>  			wbc->sync_mode == WB_SYNC_NONE &&
>  			get_dirty_pages(inode) < nr_pages_to_skip(sbi, DATA) &&
>  			f2fs_available_free_memory(sbi, DIRTY_DENTS))
> 


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH] f2fs: don't skip writeback of quota data
  2020-07-09  7:10 ` Chao Yu
@ 2020-07-09 19:05   ` Jaegeuk Kim
  2020-07-10  3:15     ` Chao Yu
  0 siblings, 1 reply; 15+ messages in thread
From: Jaegeuk Kim @ 2020-07-09 19:05 UTC (permalink / raw)
  To: Chao Yu; +Cc: kernel-team, linux-kernel, linux-f2fs-devel

On 07/09, Chao Yu wrote:
> On 2020/7/9 13:30, Jaegeuk Kim wrote:
> > It doesn't need to bypass flushing quota data in background.
> 
> The condition is used to flush quota data in batch to avoid random
> small-sized udpate, did you hit any problem here?

I suspect this causes fault injection test being stuck by waiting for inode
writeback completion. With this patch, it has been running w/o any issue so far.
I keep an eye on this.

Thanks,

> 
> Thanks,
> 
> > 
> > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> > ---
> >  fs/f2fs/data.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> > index 44645f4f914b6..72e8b50e588c1 100644
> > --- a/fs/f2fs/data.c
> > +++ b/fs/f2fs/data.c
> > @@ -3148,7 +3148,7 @@ static int __f2fs_write_data_pages(struct address_space *mapping,
> >  	if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING)))
> >  		goto skip_write;
> >  
> > -	if ((S_ISDIR(inode->i_mode) || IS_NOQUOTA(inode)) &&
> > +	if (S_ISDIR(inode->i_mode) &&
> >  			wbc->sync_mode == WB_SYNC_NONE &&
> >  			get_dirty_pages(inode) < nr_pages_to_skip(sbi, DATA) &&
> >  			f2fs_available_free_memory(sbi, DIRTY_DENTS))
> > 


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH] f2fs: don't skip writeback of quota data
  2020-07-09 19:05   ` Jaegeuk Kim
@ 2020-07-10  3:15     ` Chao Yu
  2020-07-10  3:26       ` Jaegeuk Kim
  0 siblings, 1 reply; 15+ messages in thread
From: Chao Yu @ 2020-07-10  3:15 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: kernel-team, linux-kernel, linux-f2fs-devel

On 2020/7/10 3:05, Jaegeuk Kim wrote:
> On 07/09, Chao Yu wrote:
>> On 2020/7/9 13:30, Jaegeuk Kim wrote:
>>> It doesn't need to bypass flushing quota data in background.
>>
>> The condition is used to flush quota data in batch to avoid random
>> small-sized udpate, did you hit any problem here?
> 
> I suspect this causes fault injection test being stuck by waiting for inode
> writeback completion. With this patch, it has been running w/o any issue so far.
> I keep an eye on this.

Hmmm.. so that this patch may not fix the root cause, and it may hiding the
issue deeper.

How about just keeping this patch in our private branch to let fault injection
test not be stuck? until we find the root cause in upstream codes.

Thanks,

> 
> Thanks,
> 
>>
>> Thanks,
>>
>>>
>>> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
>>> ---
>>>  fs/f2fs/data.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
>>> index 44645f4f914b6..72e8b50e588c1 100644
>>> --- a/fs/f2fs/data.c
>>> +++ b/fs/f2fs/data.c
>>> @@ -3148,7 +3148,7 @@ static int __f2fs_write_data_pages(struct address_space *mapping,
>>>  	if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING)))
>>>  		goto skip_write;
>>>  
>>> -	if ((S_ISDIR(inode->i_mode) || IS_NOQUOTA(inode)) &&
>>> +	if (S_ISDIR(inode->i_mode) &&
>>>  			wbc->sync_mode == WB_SYNC_NONE &&
>>>  			get_dirty_pages(inode) < nr_pages_to_skip(sbi, DATA) &&
>>>  			f2fs_available_free_memory(sbi, DIRTY_DENTS))
>>>
> .
> 


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH] f2fs: don't skip writeback of quota data
  2020-07-10  3:15     ` Chao Yu
@ 2020-07-10  3:26       ` Jaegeuk Kim
  2020-07-10  3:41         ` Chao Yu
  0 siblings, 1 reply; 15+ messages in thread
From: Jaegeuk Kim @ 2020-07-10  3:26 UTC (permalink / raw)
  To: Chao Yu; +Cc: kernel-team, linux-kernel, linux-f2fs-devel

On 07/10, Chao Yu wrote:
> On 2020/7/10 3:05, Jaegeuk Kim wrote:
> > On 07/09, Chao Yu wrote:
> >> On 2020/7/9 13:30, Jaegeuk Kim wrote:
> >>> It doesn't need to bypass flushing quota data in background.
> >>
> >> The condition is used to flush quota data in batch to avoid random
> >> small-sized udpate, did you hit any problem here?
> > 
> > I suspect this causes fault injection test being stuck by waiting for inode
> > writeback completion. With this patch, it has been running w/o any issue so far.
> > I keep an eye on this.
> 
> Hmmm.. so that this patch may not fix the root cause, and it may hiding the
> issue deeper.
> 
> How about just keeping this patch in our private branch to let fault injection
> test not be stuck? until we find the root cause in upstream codes.

Well, I don't think this hides something. When the issue happens, I saw inodes
being stuck due to writeback while only quota has some dirty data. At that time,
there was no dirty data page from other inodes.

More specifically, I suspect __writeback_inodes_sb_nr() gives WB_SYNC_NONE and
waits for wb_wait_for_completion().

> 
> Thanks,
> 
> > 
> > Thanks,
> > 
> >>
> >> Thanks,
> >>
> >>>
> >>> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> >>> ---
> >>>  fs/f2fs/data.c | 2 +-
> >>>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>>
> >>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> >>> index 44645f4f914b6..72e8b50e588c1 100644
> >>> --- a/fs/f2fs/data.c
> >>> +++ b/fs/f2fs/data.c
> >>> @@ -3148,7 +3148,7 @@ static int __f2fs_write_data_pages(struct address_space *mapping,
> >>>  	if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING)))
> >>>  		goto skip_write;
> >>>  
> >>> -	if ((S_ISDIR(inode->i_mode) || IS_NOQUOTA(inode)) &&
> >>> +	if (S_ISDIR(inode->i_mode) &&
> >>>  			wbc->sync_mode == WB_SYNC_NONE &&
> >>>  			get_dirty_pages(inode) < nr_pages_to_skip(sbi, DATA) &&
> >>>  			f2fs_available_free_memory(sbi, DIRTY_DENTS))
> >>>
> > .
> > 


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH] f2fs: don't skip writeback of quota data
  2020-07-10  3:26       ` Jaegeuk Kim
@ 2020-07-10  3:41         ` Chao Yu
  2020-07-10  3:50           ` Jaegeuk Kim
  0 siblings, 1 reply; 15+ messages in thread
From: Chao Yu @ 2020-07-10  3:41 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: kernel-team, linux-kernel, linux-f2fs-devel

On 2020/7/10 11:26, Jaegeuk Kim wrote:
> On 07/10, Chao Yu wrote:
>> On 2020/7/10 3:05, Jaegeuk Kim wrote:
>>> On 07/09, Chao Yu wrote:
>>>> On 2020/7/9 13:30, Jaegeuk Kim wrote:
>>>>> It doesn't need to bypass flushing quota data in background.
>>>>
>>>> The condition is used to flush quota data in batch to avoid random
>>>> small-sized udpate, did you hit any problem here?
>>>
>>> I suspect this causes fault injection test being stuck by waiting for inode
>>> writeback completion. With this patch, it has been running w/o any issue so far.
>>> I keep an eye on this.
>>
>> Hmmm.. so that this patch may not fix the root cause, and it may hiding the
>> issue deeper.
>>
>> How about just keeping this patch in our private branch to let fault injection
>> test not be stuck? until we find the root cause in upstream codes.
> 
> Well, I don't think this hides something. When the issue happens, I saw inodes
> being stuck due to writeback while only quota has some dirty data. At that time,
> there was no dirty data page from other inodes.

Okay,

> 
> More specifically, I suspect __writeback_inodes_sb_nr() gives WB_SYNC_NONE and
> waits for wb_wait_for_completion().

Did you record any callstack after the issue happened?

Still I'm confused that why directory's data written could be skipped, but
quota's data couldn't, what's the difference?

> 
>>
>> Thanks,
>>
>>>
>>> Thanks,
>>>
>>>>
>>>> Thanks,
>>>>
>>>>>
>>>>> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
>>>>> ---
>>>>>  fs/f2fs/data.c | 2 +-
>>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
>>>>> index 44645f4f914b6..72e8b50e588c1 100644
>>>>> --- a/fs/f2fs/data.c
>>>>> +++ b/fs/f2fs/data.c
>>>>> @@ -3148,7 +3148,7 @@ static int __f2fs_write_data_pages(struct address_space *mapping,
>>>>>  	if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING)))
>>>>>  		goto skip_write;
>>>>>  
>>>>> -	if ((S_ISDIR(inode->i_mode) || IS_NOQUOTA(inode)) &&
>>>>> +	if (S_ISDIR(inode->i_mode) &&
>>>>>  			wbc->sync_mode == WB_SYNC_NONE &&
>>>>>  			get_dirty_pages(inode) < nr_pages_to_skip(sbi, DATA) &&
>>>>>  			f2fs_available_free_memory(sbi, DIRTY_DENTS))
>>>>>
>>> .
>>>
> .
> 


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH] f2fs: don't skip writeback of quota data
  2020-07-10  3:41         ` Chao Yu
@ 2020-07-10  3:50           ` Jaegeuk Kim
  2020-07-10  7:31             ` Chao Yu
  0 siblings, 1 reply; 15+ messages in thread
From: Jaegeuk Kim @ 2020-07-10  3:50 UTC (permalink / raw)
  To: Chao Yu; +Cc: kernel-team, linux-kernel, linux-f2fs-devel

On 07/10, Chao Yu wrote:
> On 2020/7/10 11:26, Jaegeuk Kim wrote:
> > On 07/10, Chao Yu wrote:
> >> On 2020/7/10 3:05, Jaegeuk Kim wrote:
> >>> On 07/09, Chao Yu wrote:
> >>>> On 2020/7/9 13:30, Jaegeuk Kim wrote:
> >>>>> It doesn't need to bypass flushing quota data in background.
> >>>>
> >>>> The condition is used to flush quota data in batch to avoid random
> >>>> small-sized udpate, did you hit any problem here?
> >>>
> >>> I suspect this causes fault injection test being stuck by waiting for inode
> >>> writeback completion. With this patch, it has been running w/o any issue so far.
> >>> I keep an eye on this.
> >>
> >> Hmmm.. so that this patch may not fix the root cause, and it may hiding the
> >> issue deeper.
> >>
> >> How about just keeping this patch in our private branch to let fault injection
> >> test not be stuck? until we find the root cause in upstream codes.
> > 
> > Well, I don't think this hides something. When the issue happens, I saw inodes
> > being stuck due to writeback while only quota has some dirty data. At that time,
> > there was no dirty data page from other inodes.
> 
> Okay,
> 
> > 
> > More specifically, I suspect __writeback_inodes_sb_nr() gives WB_SYNC_NONE and
> > waits for wb_wait_for_completion().
> 
> Did you record any callstack after the issue happened?

I found this.

[213389.297642]  __schedule+0x2dd/0x780^M
[213389.299224]  schedule+0x55/0xc0^M
[213389.300745]  wb_wait_for_completion+0x56/0x90^M
[213389.302469]  ? wait_woken+0x80/0x80^M
[213389.303997]  __writeback_inodes_sb_nr+0xa8/0xd0^M
[213389.305760]  writeback_inodes_sb+0x4b/0x60^M
[213389.307439]  sync_filesystem+0x2e/0xa0^M
[213389.308999]  generic_shutdown_super+0x27/0x110^M
[213389.310738]  kill_block_super+0x27/0x50^M
[213389.312327]  kill_f2fs_super+0x76/0xe0 [f2fs]^M
[213389.314014]  deactivate_locked_super+0x3b/0x80^M
[213389.315692]  deactivate_super+0x3e/0x50^M
[213389.317226]  cleanup_mnt+0x109/0x160^M
[213389.318718]  __cleanup_mnt+0x12/0x20^M
[213389.320177]  task_work_run+0x70/0xb0^M
[213389.321609]  exit_to_usermode_loop+0x131/0x160^M
[213389.323306]  do_syscall_64+0x170/0x1b0^M
[213389.324762]  entry_SYSCALL_64_after_hwframe+0x44/0xa9^M
[213389.326477] RIP: 0033:0x7fc4b5e6a35b^M

> 
> Still I'm confused that why directory's data written could be skipped, but
> quota's data couldn't, what's the difference?

I suspect different blocking timing from cp_error between quota and dentry.
e.g., we block dir operations right after cp_error, while quota can make
dirty pages in more fine granularity.

> 
> > 
> >>
> >> Thanks,
> >>
> >>>
> >>> Thanks,
> >>>
> >>>>
> >>>> Thanks,
> >>>>
> >>>>>
> >>>>> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> >>>>> ---
> >>>>>  fs/f2fs/data.c | 2 +-
> >>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>>>>
> >>>>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> >>>>> index 44645f4f914b6..72e8b50e588c1 100644
> >>>>> --- a/fs/f2fs/data.c
> >>>>> +++ b/fs/f2fs/data.c
> >>>>> @@ -3148,7 +3148,7 @@ static int __f2fs_write_data_pages(struct address_space *mapping,
> >>>>>  	if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING)))
> >>>>>  		goto skip_write;
> >>>>>  
> >>>>> -	if ((S_ISDIR(inode->i_mode) || IS_NOQUOTA(inode)) &&
> >>>>> +	if (S_ISDIR(inode->i_mode) &&
> >>>>>  			wbc->sync_mode == WB_SYNC_NONE &&
> >>>>>  			get_dirty_pages(inode) < nr_pages_to_skip(sbi, DATA) &&
> >>>>>  			f2fs_available_free_memory(sbi, DIRTY_DENTS))
> >>>>>
> >>> .
> >>>
> > .
> > 


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH] f2fs: don't skip writeback of quota data
  2020-07-10  3:50           ` Jaegeuk Kim
@ 2020-07-10  7:31             ` Chao Yu
  2020-07-10  8:16               ` Jaegeuk Kim
  2020-07-13 17:59               ` Jaegeuk Kim
  0 siblings, 2 replies; 15+ messages in thread
From: Chao Yu @ 2020-07-10  7:31 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: kernel-team, linux-kernel, linux-f2fs-devel

On 2020/7/10 11:50, Jaegeuk Kim wrote:
> On 07/10, Chao Yu wrote:
>> On 2020/7/10 11:26, Jaegeuk Kim wrote:
>>> On 07/10, Chao Yu wrote:
>>>> On 2020/7/10 3:05, Jaegeuk Kim wrote:
>>>>> On 07/09, Chao Yu wrote:
>>>>>> On 2020/7/9 13:30, Jaegeuk Kim wrote:
>>>>>>> It doesn't need to bypass flushing quota data in background.
>>>>>>
>>>>>> The condition is used to flush quota data in batch to avoid random
>>>>>> small-sized udpate, did you hit any problem here?
>>>>>
>>>>> I suspect this causes fault injection test being stuck by waiting for inode
>>>>> writeback completion. With this patch, it has been running w/o any issue so far.
>>>>> I keep an eye on this.
>>>>
>>>> Hmmm.. so that this patch may not fix the root cause, and it may hiding the
>>>> issue deeper.
>>>>
>>>> How about just keeping this patch in our private branch to let fault injection
>>>> test not be stuck? until we find the root cause in upstream codes.
>>>
>>> Well, I don't think this hides something. When the issue happens, I saw inodes
>>> being stuck due to writeback while only quota has some dirty data. At that time,
>>> there was no dirty data page from other inodes.
>>
>> Okay,
>>
>>>
>>> More specifically, I suspect __writeback_inodes_sb_nr() gives WB_SYNC_NONE and
>>> waits for wb_wait_for_completion().
>>
>> Did you record any callstack after the issue happened?
> 
> I found this.
> 
> [213389.297642]  __schedule+0x2dd/0x780^M
> [213389.299224]  schedule+0x55/0xc0^M
> [213389.300745]  wb_wait_for_completion+0x56/0x90^M
> [213389.302469]  ? wait_woken+0x80/0x80^M
> [213389.303997]  __writeback_inodes_sb_nr+0xa8/0xd0^M
> [213389.305760]  writeback_inodes_sb+0x4b/0x60^M
> [213389.307439]  sync_filesystem+0x2e/0xa0^M
> [213389.308999]  generic_shutdown_super+0x27/0x110^M
> [213389.310738]  kill_block_super+0x27/0x50^M
> [213389.312327]  kill_f2fs_super+0x76/0xe0 [f2fs]^M
> [213389.314014]  deactivate_locked_super+0x3b/0x80^M
> [213389.315692]  deactivate_super+0x3e/0x50^M
> [213389.317226]  cleanup_mnt+0x109/0x160^M
> [213389.318718]  __cleanup_mnt+0x12/0x20^M
> [213389.320177]  task_work_run+0x70/0xb0^M
> [213389.321609]  exit_to_usermode_loop+0x131/0x160^M
> [213389.323306]  do_syscall_64+0x170/0x1b0^M
> [213389.324762]  entry_SYSCALL_64_after_hwframe+0x44/0xa9^M
> [213389.326477] RIP: 0033:0x7fc4b5e6a35b^M

Does this only happen during umount? If so, will below change help?

	if ((S_ISDIR(inode->i_mode) || IS_NOQUOTA(inode)) &&
+			!is_sbi_flag_set(sbi, SBI_IS_CLOSE) &&
			wbc->sync_mode == WB_SYNC_NONE &&
			get_dirty_pages(inode) < nr_pages_to_skip(sbi, DATA) &&
			f2fs_available_free_memory(sbi, DIRTY_DENTS))
		goto skip_write;

> 
>>
>> Still I'm confused that why directory's data written could be skipped, but
>> quota's data couldn't, what's the difference?
> 
> I suspect different blocking timing from cp_error between quota and dentry.
> e.g., we block dir operations right after cp_error, while quota can make

No guarantee that there is no dirty dentry being created after
cp_error, right?

e.g.

Thread A				Thread B
- f2fs_create
- bypass f2fs_cp_error
					- set cp_error
- create dirty dentry

BTW, do you know what __writeback_inodes_sb_nr is waiting for?

> dirty pages in more fine granularity.
> 
>>
>>>
>>>>
>>>> Thanks,
>>>>
>>>>>
>>>>> Thanks,
>>>>>
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>>>
>>>>>>> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
>>>>>>> ---
>>>>>>>  fs/f2fs/data.c | 2 +-
>>>>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>>>
>>>>>>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
>>>>>>> index 44645f4f914b6..72e8b50e588c1 100644
>>>>>>> --- a/fs/f2fs/data.c
>>>>>>> +++ b/fs/f2fs/data.c
>>>>>>> @@ -3148,7 +3148,7 @@ static int __f2fs_write_data_pages(struct address_space *mapping,
>>>>>>>  	if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING)))
>>>>>>>  		goto skip_write;
>>>>>>>  
>>>>>>> -	if ((S_ISDIR(inode->i_mode) || IS_NOQUOTA(inode)) &&
>>>>>>> +	if (S_ISDIR(inode->i_mode) &&
>>>>>>>  			wbc->sync_mode == WB_SYNC_NONE &&
>>>>>>>  			get_dirty_pages(inode) < nr_pages_to_skip(sbi, DATA) &&
>>>>>>>  			f2fs_available_free_memory(sbi, DIRTY_DENTS))
>>>>>>>
>>>>> .
>>>>>
>>> .
>>>
> .
> 


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH] f2fs: don't skip writeback of quota data
  2020-07-10  7:31             ` Chao Yu
@ 2020-07-10  8:16               ` Jaegeuk Kim
  2020-07-13 17:59               ` Jaegeuk Kim
  1 sibling, 0 replies; 15+ messages in thread
From: Jaegeuk Kim @ 2020-07-10  8:16 UTC (permalink / raw)
  To: Chao Yu; +Cc: kernel-team, linux-kernel, linux-f2fs-devel

On 07/10, Chao Yu wrote:
> On 2020/7/10 11:50, Jaegeuk Kim wrote:
> > On 07/10, Chao Yu wrote:
> >> On 2020/7/10 11:26, Jaegeuk Kim wrote:
> >>> On 07/10, Chao Yu wrote:
> >>>> On 2020/7/10 3:05, Jaegeuk Kim wrote:
> >>>>> On 07/09, Chao Yu wrote:
> >>>>>> On 2020/7/9 13:30, Jaegeuk Kim wrote:
> >>>>>>> It doesn't need to bypass flushing quota data in background.
> >>>>>>
> >>>>>> The condition is used to flush quota data in batch to avoid random
> >>>>>> small-sized udpate, did you hit any problem here?
> >>>>>
> >>>>> I suspect this causes fault injection test being stuck by waiting for inode
> >>>>> writeback completion. With this patch, it has been running w/o any issue so far.
> >>>>> I keep an eye on this.
> >>>>
> >>>> Hmmm.. so that this patch may not fix the root cause, and it may hiding the
> >>>> issue deeper.
> >>>>
> >>>> How about just keeping this patch in our private branch to let fault injection
> >>>> test not be stuck? until we find the root cause in upstream codes.
> >>>
> >>> Well, I don't think this hides something. When the issue happens, I saw inodes
> >>> being stuck due to writeback while only quota has some dirty data. At that time,
> >>> there was no dirty data page from other inodes.
> >>
> >> Okay,
> >>
> >>>
> >>> More specifically, I suspect __writeback_inodes_sb_nr() gives WB_SYNC_NONE and
> >>> waits for wb_wait_for_completion().
> >>
> >> Did you record any callstack after the issue happened?
> > 
> > I found this.
> > 
> > [213389.297642]  __schedule+0x2dd/0x780^M
> > [213389.299224]  schedule+0x55/0xc0^M
> > [213389.300745]  wb_wait_for_completion+0x56/0x90^M
> > [213389.302469]  ? wait_woken+0x80/0x80^M
> > [213389.303997]  __writeback_inodes_sb_nr+0xa8/0xd0^M
> > [213389.305760]  writeback_inodes_sb+0x4b/0x60^M
> > [213389.307439]  sync_filesystem+0x2e/0xa0^M
> > [213389.308999]  generic_shutdown_super+0x27/0x110^M
> > [213389.310738]  kill_block_super+0x27/0x50^M
> > [213389.312327]  kill_f2fs_super+0x76/0xe0 [f2fs]^M
> > [213389.314014]  deactivate_locked_super+0x3b/0x80^M
> > [213389.315692]  deactivate_super+0x3e/0x50^M
> > [213389.317226]  cleanup_mnt+0x109/0x160^M
> > [213389.318718]  __cleanup_mnt+0x12/0x20^M
> > [213389.320177]  task_work_run+0x70/0xb0^M
> > [213389.321609]  exit_to_usermode_loop+0x131/0x160^M
> > [213389.323306]  do_syscall_64+0x170/0x1b0^M
> > [213389.324762]  entry_SYSCALL_64_after_hwframe+0x44/0xa9^M
> > [213389.326477] RIP: 0033:0x7fc4b5e6a35b^M
> 
> Does this only happen during umount? If so, will below change help?

Will give it a try. It's quite flaky so may take some time.

> 
> 	if ((S_ISDIR(inode->i_mode) || IS_NOQUOTA(inode)) &&
> +			!is_sbi_flag_set(sbi, SBI_IS_CLOSE) &&
> 			wbc->sync_mode == WB_SYNC_NONE &&
> 			get_dirty_pages(inode) < nr_pages_to_skip(sbi, DATA) &&
> 			f2fs_available_free_memory(sbi, DIRTY_DENTS))
> 		goto skip_write;
> 
> > 
> >>
> >> Still I'm confused that why directory's data written could be skipped, but
> >> quota's data couldn't, what's the difference?
> > 
> > I suspect different blocking timing from cp_error between quota and dentry.
> > e.g., we block dir operations right after cp_error, while quota can make
> 
> No guarantee that there is no dirty dentry being created after
> cp_error, right?
> 
> e.g.
> 
> Thread A				Thread B
> - f2fs_create
> - bypass f2fs_cp_error
> 					- set cp_error
> - create dirty dentry
> 
> BTW, do you know what __writeback_inodes_sb_nr is waiting for?
> 
> > dirty pages in more fine granularity.
> > 
> >>
> >>>
> >>>>
> >>>> Thanks,
> >>>>
> >>>>>
> >>>>> Thanks,
> >>>>>
> >>>>>>
> >>>>>> Thanks,
> >>>>>>
> >>>>>>>
> >>>>>>> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> >>>>>>> ---
> >>>>>>>  fs/f2fs/data.c | 2 +-
> >>>>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>>>>>>
> >>>>>>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> >>>>>>> index 44645f4f914b6..72e8b50e588c1 100644
> >>>>>>> --- a/fs/f2fs/data.c
> >>>>>>> +++ b/fs/f2fs/data.c
> >>>>>>> @@ -3148,7 +3148,7 @@ static int __f2fs_write_data_pages(struct address_space *mapping,
> >>>>>>>  	if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING)))
> >>>>>>>  		goto skip_write;
> >>>>>>>  
> >>>>>>> -	if ((S_ISDIR(inode->i_mode) || IS_NOQUOTA(inode)) &&
> >>>>>>> +	if (S_ISDIR(inode->i_mode) &&
> >>>>>>>  			wbc->sync_mode == WB_SYNC_NONE &&
> >>>>>>>  			get_dirty_pages(inode) < nr_pages_to_skip(sbi, DATA) &&
> >>>>>>>  			f2fs_available_free_memory(sbi, DIRTY_DENTS))
> >>>>>>>
> >>>>> .
> >>>>>
> >>> .
> >>>
> > .
> > 


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH] f2fs: don't skip writeback of quota data
  2020-07-10  7:31             ` Chao Yu
  2020-07-10  8:16               ` Jaegeuk Kim
@ 2020-07-13 17:59               ` Jaegeuk Kim
  2020-07-14 12:14                 ` Chao Yu
  1 sibling, 1 reply; 15+ messages in thread
From: Jaegeuk Kim @ 2020-07-13 17:59 UTC (permalink / raw)
  To: Chao Yu; +Cc: kernel-team, linux-kernel, linux-f2fs-devel

On 07/10, Chao Yu wrote:
> On 2020/7/10 11:50, Jaegeuk Kim wrote:
> > On 07/10, Chao Yu wrote:
> >> On 2020/7/10 11:26, Jaegeuk Kim wrote:
> >>> On 07/10, Chao Yu wrote:
> >>>> On 2020/7/10 3:05, Jaegeuk Kim wrote:
> >>>>> On 07/09, Chao Yu wrote:
> >>>>>> On 2020/7/9 13:30, Jaegeuk Kim wrote:
> >>>>>>> It doesn't need to bypass flushing quota data in background.
> >>>>>>
> >>>>>> The condition is used to flush quota data in batch to avoid random
> >>>>>> small-sized udpate, did you hit any problem here?
> >>>>>
> >>>>> I suspect this causes fault injection test being stuck by waiting for inode
> >>>>> writeback completion. With this patch, it has been running w/o any issue so far.
> >>>>> I keep an eye on this.
> >>>>
> >>>> Hmmm.. so that this patch may not fix the root cause, and it may hiding the
> >>>> issue deeper.
> >>>>
> >>>> How about just keeping this patch in our private branch to let fault injection
> >>>> test not be stuck? until we find the root cause in upstream codes.
> >>>
> >>> Well, I don't think this hides something. When the issue happens, I saw inodes
> >>> being stuck due to writeback while only quota has some dirty data. At that time,
> >>> there was no dirty data page from other inodes.
> >>
> >> Okay,
> >>
> >>>
> >>> More specifically, I suspect __writeback_inodes_sb_nr() gives WB_SYNC_NONE and
> >>> waits for wb_wait_for_completion().
> >>
> >> Did you record any callstack after the issue happened?
> > 
> > I found this.
> > 
> > [213389.297642]  __schedule+0x2dd/0x780^M
> > [213389.299224]  schedule+0x55/0xc0^M
> > [213389.300745]  wb_wait_for_completion+0x56/0x90^M
> > [213389.302469]  ? wait_woken+0x80/0x80^M
> > [213389.303997]  __writeback_inodes_sb_nr+0xa8/0xd0^M
> > [213389.305760]  writeback_inodes_sb+0x4b/0x60^M
> > [213389.307439]  sync_filesystem+0x2e/0xa0^M
> > [213389.308999]  generic_shutdown_super+0x27/0x110^M
> > [213389.310738]  kill_block_super+0x27/0x50^M
> > [213389.312327]  kill_f2fs_super+0x76/0xe0 [f2fs]^M
> > [213389.314014]  deactivate_locked_super+0x3b/0x80^M
> > [213389.315692]  deactivate_super+0x3e/0x50^M
> > [213389.317226]  cleanup_mnt+0x109/0x160^M
> > [213389.318718]  __cleanup_mnt+0x12/0x20^M
> > [213389.320177]  task_work_run+0x70/0xb0^M
> > [213389.321609]  exit_to_usermode_loop+0x131/0x160^M
> > [213389.323306]  do_syscall_64+0x170/0x1b0^M
> > [213389.324762]  entry_SYSCALL_64_after_hwframe+0x44/0xa9^M
> > [213389.326477] RIP: 0033:0x7fc4b5e6a35b^M
> 
> Does this only happen during umount? If so, will below change help?
> 
> 	if ((S_ISDIR(inode->i_mode) || IS_NOQUOTA(inode)) &&
> +			!is_sbi_flag_set(sbi, SBI_IS_CLOSE) &&
> 			wbc->sync_mode == WB_SYNC_NONE &&
> 			get_dirty_pages(inode) < nr_pages_to_skip(sbi, DATA) &&
> 			f2fs_available_free_memory(sbi, DIRTY_DENTS))
> 		goto skip_write;

Hmm, this doesn't work. The writeback was called before put_super?
I'll try the original patch one more time.

> 
> > 
> >>
> >> Still I'm confused that why directory's data written could be skipped, but
> >> quota's data couldn't, what's the difference?
> > 
> > I suspect different blocking timing from cp_error between quota and dentry.
> > e.g., we block dir operations right after cp_error, while quota can make
> 
> No guarantee that there is no dirty dentry being created after
> cp_error, right?
> 
> e.g.
> 
> Thread A				Thread B
> - f2fs_create
> - bypass f2fs_cp_error
> 					- set cp_error
> - create dirty dentry
> 
> BTW, do you know what __writeback_inodes_sb_nr is waiting for?
> 
> > dirty pages in more fine granularity.
> > 
> >>
> >>>
> >>>>
> >>>> Thanks,
> >>>>
> >>>>>
> >>>>> Thanks,
> >>>>>
> >>>>>>
> >>>>>> Thanks,
> >>>>>>
> >>>>>>>
> >>>>>>> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> >>>>>>> ---
> >>>>>>>  fs/f2fs/data.c | 2 +-
> >>>>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>>>>>>
> >>>>>>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> >>>>>>> index 44645f4f914b6..72e8b50e588c1 100644
> >>>>>>> --- a/fs/f2fs/data.c
> >>>>>>> +++ b/fs/f2fs/data.c
> >>>>>>> @@ -3148,7 +3148,7 @@ static int __f2fs_write_data_pages(struct address_space *mapping,
> >>>>>>>  	if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING)))
> >>>>>>>  		goto skip_write;
> >>>>>>>  
> >>>>>>> -	if ((S_ISDIR(inode->i_mode) || IS_NOQUOTA(inode)) &&
> >>>>>>> +	if (S_ISDIR(inode->i_mode) &&
> >>>>>>>  			wbc->sync_mode == WB_SYNC_NONE &&
> >>>>>>>  			get_dirty_pages(inode) < nr_pages_to_skip(sbi, DATA) &&
> >>>>>>>  			f2fs_available_free_memory(sbi, DIRTY_DENTS))
> >>>>>>>
> >>>>> .
> >>>>>
> >>> .
> >>>
> > .
> > 


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH] f2fs: don't skip writeback of quota data
  2020-07-13 17:59               ` Jaegeuk Kim
@ 2020-07-14 12:14                 ` Chao Yu
  2020-07-15 19:10                   ` Jaegeuk Kim
  0 siblings, 1 reply; 15+ messages in thread
From: Chao Yu @ 2020-07-14 12:14 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: kernel-team, linux-kernel, linux-f2fs-devel

On 2020/7/14 1:59, Jaegeuk Kim wrote:
> On 07/10, Chao Yu wrote:
>> On 2020/7/10 11:50, Jaegeuk Kim wrote:
>>> On 07/10, Chao Yu wrote:
>>>> On 2020/7/10 11:26, Jaegeuk Kim wrote:
>>>>> On 07/10, Chao Yu wrote:
>>>>>> On 2020/7/10 3:05, Jaegeuk Kim wrote:
>>>>>>> On 07/09, Chao Yu wrote:
>>>>>>>> On 2020/7/9 13:30, Jaegeuk Kim wrote:
>>>>>>>>> It doesn't need to bypass flushing quota data in background.
>>>>>>>>
>>>>>>>> The condition is used to flush quota data in batch to avoid random
>>>>>>>> small-sized udpate, did you hit any problem here?
>>>>>>>
>>>>>>> I suspect this causes fault injection test being stuck by waiting for inode
>>>>>>> writeback completion. With this patch, it has been running w/o any issue so far.
>>>>>>> I keep an eye on this.
>>>>>>
>>>>>> Hmmm.. so that this patch may not fix the root cause, and it may hiding the
>>>>>> issue deeper.
>>>>>>
>>>>>> How about just keeping this patch in our private branch to let fault injection
>>>>>> test not be stuck? until we find the root cause in upstream codes.
>>>>>
>>>>> Well, I don't think this hides something. When the issue happens, I saw inodes
>>>>> being stuck due to writeback while only quota has some dirty data. At that time,
>>>>> there was no dirty data page from other inodes.
>>>>
>>>> Okay,
>>>>
>>>>>
>>>>> More specifically, I suspect __writeback_inodes_sb_nr() gives WB_SYNC_NONE and
>>>>> waits for wb_wait_for_completion().
>>>>
>>>> Did you record any callstack after the issue happened?
>>>
>>> I found this.
>>>
>>> [213389.297642]  __schedule+0x2dd/0x780^M
>>> [213389.299224]  schedule+0x55/0xc0^M
>>> [213389.300745]  wb_wait_for_completion+0x56/0x90^M
>>> [213389.302469]  ? wait_woken+0x80/0x80^M
>>> [213389.303997]  __writeback_inodes_sb_nr+0xa8/0xd0^M
>>> [213389.305760]  writeback_inodes_sb+0x4b/0x60^M
>>> [213389.307439]  sync_filesystem+0x2e/0xa0^M
>>> [213389.308999]  generic_shutdown_super+0x27/0x110^M
>>> [213389.310738]  kill_block_super+0x27/0x50^M
>>> [213389.312327]  kill_f2fs_super+0x76/0xe0 [f2fs]^M
>>> [213389.314014]  deactivate_locked_super+0x3b/0x80^M
>>> [213389.315692]  deactivate_super+0x3e/0x50^M
>>> [213389.317226]  cleanup_mnt+0x109/0x160^M
>>> [213389.318718]  __cleanup_mnt+0x12/0x20^M
>>> [213389.320177]  task_work_run+0x70/0xb0^M
>>> [213389.321609]  exit_to_usermode_loop+0x131/0x160^M
>>> [213389.323306]  do_syscall_64+0x170/0x1b0^M
>>> [213389.324762]  entry_SYSCALL_64_after_hwframe+0x44/0xa9^M
>>> [213389.326477] RIP: 0033:0x7fc4b5e6a35b^M
>>
>> Does this only happen during umount? If so, will below change help?
>>
>> 	if ((S_ISDIR(inode->i_mode) || IS_NOQUOTA(inode)) &&
>> +			!is_sbi_flag_set(sbi, SBI_IS_CLOSE) &&
>> 			wbc->sync_mode == WB_SYNC_NONE &&
>> 			get_dirty_pages(inode) < nr_pages_to_skip(sbi, DATA) &&
>> 			f2fs_available_free_memory(sbi, DIRTY_DENTS))
>> 		goto skip_write;
> 
> Hmm, this doesn't work. The writeback was called before put_super?

Oops, still be confused about this issue. :(

Thanks,

> I'll try the original patch one more time.
> 
>>
>>>
>>>>
>>>> Still I'm confused that why directory's data written could be skipped, but
>>>> quota's data couldn't, what's the difference?
>>>
>>> I suspect different blocking timing from cp_error between quota and dentry.
>>> e.g., we block dir operations right after cp_error, while quota can make
>>
>> No guarantee that there is no dirty dentry being created after
>> cp_error, right?
>>
>> e.g.
>>
>> Thread A				Thread B
>> - f2fs_create
>> - bypass f2fs_cp_error
>> 					- set cp_error
>> - create dirty dentry
>>
>> BTW, do you know what __writeback_inodes_sb_nr is waiting for?
>>
>>> dirty pages in more fine granularity.
>>>
>>>>
>>>>>
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>>>
>>>>>>> Thanks,
>>>>>>>
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>>
>>>>>>>>>
>>>>>>>>> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
>>>>>>>>> ---
>>>>>>>>>  fs/f2fs/data.c | 2 +-
>>>>>>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>>>>>
>>>>>>>>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
>>>>>>>>> index 44645f4f914b6..72e8b50e588c1 100644
>>>>>>>>> --- a/fs/f2fs/data.c
>>>>>>>>> +++ b/fs/f2fs/data.c
>>>>>>>>> @@ -3148,7 +3148,7 @@ static int __f2fs_write_data_pages(struct address_space *mapping,
>>>>>>>>>  	if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING)))
>>>>>>>>>  		goto skip_write;
>>>>>>>>>  
>>>>>>>>> -	if ((S_ISDIR(inode->i_mode) || IS_NOQUOTA(inode)) &&
>>>>>>>>> +	if (S_ISDIR(inode->i_mode) &&
>>>>>>>>>  			wbc->sync_mode == WB_SYNC_NONE &&
>>>>>>>>>  			get_dirty_pages(inode) < nr_pages_to_skip(sbi, DATA) &&
>>>>>>>>>  			f2fs_available_free_memory(sbi, DIRTY_DENTS))
>>>>>>>>>
>>>>>>> .
>>>>>>>
>>>>> .
>>>>>
>>> .
>>>
> .
> 


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH] f2fs: don't skip writeback of quota data
  2020-07-14 12:14                 ` Chao Yu
@ 2020-07-15 19:10                   ` Jaegeuk Kim
  2020-07-16  1:08                     ` Chao Yu
  0 siblings, 1 reply; 15+ messages in thread
From: Jaegeuk Kim @ 2020-07-15 19:10 UTC (permalink / raw)
  To: Chao Yu; +Cc: kernel-team, linux-kernel, linux-f2fs-devel

On 07/14, Chao Yu wrote:
> On 2020/7/14 1:59, Jaegeuk Kim wrote:
> > On 07/10, Chao Yu wrote:
> >> On 2020/7/10 11:50, Jaegeuk Kim wrote:
> >>> On 07/10, Chao Yu wrote:
> >>>> On 2020/7/10 11:26, Jaegeuk Kim wrote:
> >>>>> On 07/10, Chao Yu wrote:
> >>>>>> On 2020/7/10 3:05, Jaegeuk Kim wrote:
> >>>>>>> On 07/09, Chao Yu wrote:
> >>>>>>>> On 2020/7/9 13:30, Jaegeuk Kim wrote:
> >>>>>>>>> It doesn't need to bypass flushing quota data in background.
> >>>>>>>>
> >>>>>>>> The condition is used to flush quota data in batch to avoid random
> >>>>>>>> small-sized udpate, did you hit any problem here?
> >>>>>>>
> >>>>>>> I suspect this causes fault injection test being stuck by waiting for inode
> >>>>>>> writeback completion. With this patch, it has been running w/o any issue so far.
> >>>>>>> I keep an eye on this.
> >>>>>>
> >>>>>> Hmmm.. so that this patch may not fix the root cause, and it may hiding the
> >>>>>> issue deeper.
> >>>>>>
> >>>>>> How about just keeping this patch in our private branch to let fault injection
> >>>>>> test not be stuck? until we find the root cause in upstream codes.
> >>>>>
> >>>>> Well, I don't think this hides something. When the issue happens, I saw inodes
> >>>>> being stuck due to writeback while only quota has some dirty data. At that time,
> >>>>> there was no dirty data page from other inodes.
> >>>>
> >>>> Okay,
> >>>>
> >>>>>
> >>>>> More specifically, I suspect __writeback_inodes_sb_nr() gives WB_SYNC_NONE and
> >>>>> waits for wb_wait_for_completion().
> >>>>
> >>>> Did you record any callstack after the issue happened?
> >>>
> >>> I found this.
> >>>
> >>> [213389.297642]  __schedule+0x2dd/0x780^M
> >>> [213389.299224]  schedule+0x55/0xc0^M
> >>> [213389.300745]  wb_wait_for_completion+0x56/0x90^M
> >>> [213389.302469]  ? wait_woken+0x80/0x80^M
> >>> [213389.303997]  __writeback_inodes_sb_nr+0xa8/0xd0^M
> >>> [213389.305760]  writeback_inodes_sb+0x4b/0x60^M
> >>> [213389.307439]  sync_filesystem+0x2e/0xa0^M
> >>> [213389.308999]  generic_shutdown_super+0x27/0x110^M
> >>> [213389.310738]  kill_block_super+0x27/0x50^M
> >>> [213389.312327]  kill_f2fs_super+0x76/0xe0 [f2fs]^M
> >>> [213389.314014]  deactivate_locked_super+0x3b/0x80^M
> >>> [213389.315692]  deactivate_super+0x3e/0x50^M
> >>> [213389.317226]  cleanup_mnt+0x109/0x160^M
> >>> [213389.318718]  __cleanup_mnt+0x12/0x20^M
> >>> [213389.320177]  task_work_run+0x70/0xb0^M
> >>> [213389.321609]  exit_to_usermode_loop+0x131/0x160^M
> >>> [213389.323306]  do_syscall_64+0x170/0x1b0^M
> >>> [213389.324762]  entry_SYSCALL_64_after_hwframe+0x44/0xa9^M
> >>> [213389.326477] RIP: 0033:0x7fc4b5e6a35b^M
> >>
> >> Does this only happen during umount? If so, will below change help?
> >>
> >> 	if ((S_ISDIR(inode->i_mode) || IS_NOQUOTA(inode)) &&
> >> +			!is_sbi_flag_set(sbi, SBI_IS_CLOSE) &&
> >> 			wbc->sync_mode == WB_SYNC_NONE &&
> >> 			get_dirty_pages(inode) < nr_pages_to_skip(sbi, DATA) &&
> >> 			f2fs_available_free_memory(sbi, DIRTY_DENTS))
> >> 		goto skip_write;
> > 
> > Hmm, this doesn't work. The writeback was called before put_super?
> 
> Oops, still be confused about this issue. :(

Huam, I hit the problem with the patch.
I need to return back and think in other way. :(

> 
> Thanks,
> 
> > I'll try the original patch one more time.
> > 
> >>
> >>>
> >>>>
> >>>> Still I'm confused that why directory's data written could be skipped, but
> >>>> quota's data couldn't, what's the difference?
> >>>
> >>> I suspect different blocking timing from cp_error between quota and dentry.
> >>> e.g., we block dir operations right after cp_error, while quota can make
> >>
> >> No guarantee that there is no dirty dentry being created after
> >> cp_error, right?
> >>
> >> e.g.
> >>
> >> Thread A				Thread B
> >> - f2fs_create
> >> - bypass f2fs_cp_error
> >> 					- set cp_error
> >> - create dirty dentry
> >>
> >> BTW, do you know what __writeback_inodes_sb_nr is waiting for?
> >>
> >>> dirty pages in more fine granularity.
> >>>
> >>>>
> >>>>>
> >>>>>>
> >>>>>> Thanks,
> >>>>>>
> >>>>>>>
> >>>>>>> Thanks,
> >>>>>>>
> >>>>>>>>
> >>>>>>>> Thanks,
> >>>>>>>>
> >>>>>>>>>
> >>>>>>>>> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> >>>>>>>>> ---
> >>>>>>>>>  fs/f2fs/data.c | 2 +-
> >>>>>>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>>>>>>>>
> >>>>>>>>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> >>>>>>>>> index 44645f4f914b6..72e8b50e588c1 100644
> >>>>>>>>> --- a/fs/f2fs/data.c
> >>>>>>>>> +++ b/fs/f2fs/data.c
> >>>>>>>>> @@ -3148,7 +3148,7 @@ static int __f2fs_write_data_pages(struct address_space *mapping,
> >>>>>>>>>  	if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING)))
> >>>>>>>>>  		goto skip_write;
> >>>>>>>>>  
> >>>>>>>>> -	if ((S_ISDIR(inode->i_mode) || IS_NOQUOTA(inode)) &&
> >>>>>>>>> +	if (S_ISDIR(inode->i_mode) &&
> >>>>>>>>>  			wbc->sync_mode == WB_SYNC_NONE &&
> >>>>>>>>>  			get_dirty_pages(inode) < nr_pages_to_skip(sbi, DATA) &&
> >>>>>>>>>  			f2fs_available_free_memory(sbi, DIRTY_DENTS))
> >>>>>>>>>
> >>>>>>> .
> >>>>>>>
> >>>>> .
> >>>>>
> >>> .
> >>>
> > .
> > 


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH] f2fs: don't skip writeback of quota data
  2020-07-15 19:10                   ` Jaegeuk Kim
@ 2020-07-16  1:08                     ` Chao Yu
  2020-07-16  1:10                       ` Jaegeuk Kim
  0 siblings, 1 reply; 15+ messages in thread
From: Chao Yu @ 2020-07-16  1:08 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: kernel-team, linux-kernel, linux-f2fs-devel

On 2020/7/16 3:10, Jaegeuk Kim wrote:
> On 07/14, Chao Yu wrote:
>> On 2020/7/14 1:59, Jaegeuk Kim wrote:
>>> On 07/10, Chao Yu wrote:
>>>> On 2020/7/10 11:50, Jaegeuk Kim wrote:
>>>>> On 07/10, Chao Yu wrote:
>>>>>> On 2020/7/10 11:26, Jaegeuk Kim wrote:
>>>>>>> On 07/10, Chao Yu wrote:
>>>>>>>> On 2020/7/10 3:05, Jaegeuk Kim wrote:
>>>>>>>>> On 07/09, Chao Yu wrote:
>>>>>>>>>> On 2020/7/9 13:30, Jaegeuk Kim wrote:
>>>>>>>>>>> It doesn't need to bypass flushing quota data in background.
>>>>>>>>>>
>>>>>>>>>> The condition is used to flush quota data in batch to avoid random
>>>>>>>>>> small-sized udpate, did you hit any problem here?
>>>>>>>>>
>>>>>>>>> I suspect this causes fault injection test being stuck by waiting for inode
>>>>>>>>> writeback completion. With this patch, it has been running w/o any issue so far.
>>>>>>>>> I keep an eye on this.
>>>>>>>>
>>>>>>>> Hmmm.. so that this patch may not fix the root cause, and it may hiding the
>>>>>>>> issue deeper.
>>>>>>>>
>>>>>>>> How about just keeping this patch in our private branch to let fault injection
>>>>>>>> test not be stuck? until we find the root cause in upstream codes.
>>>>>>>
>>>>>>> Well, I don't think this hides something. When the issue happens, I saw inodes
>>>>>>> being stuck due to writeback while only quota has some dirty data. At that time,
>>>>>>> there was no dirty data page from other inodes.
>>>>>>
>>>>>> Okay,
>>>>>>
>>>>>>>
>>>>>>> More specifically, I suspect __writeback_inodes_sb_nr() gives WB_SYNC_NONE and
>>>>>>> waits for wb_wait_for_completion().
>>>>>>
>>>>>> Did you record any callstack after the issue happened?
>>>>>
>>>>> I found this.
>>>>>
>>>>> [213389.297642]  __schedule+0x2dd/0x780^M
>>>>> [213389.299224]  schedule+0x55/0xc0^M
>>>>> [213389.300745]  wb_wait_for_completion+0x56/0x90^M
>>>>> [213389.302469]  ? wait_woken+0x80/0x80^M
>>>>> [213389.303997]  __writeback_inodes_sb_nr+0xa8/0xd0^M
>>>>> [213389.305760]  writeback_inodes_sb+0x4b/0x60^M
>>>>> [213389.307439]  sync_filesystem+0x2e/0xa0^M
>>>>> [213389.308999]  generic_shutdown_super+0x27/0x110^M
>>>>> [213389.310738]  kill_block_super+0x27/0x50^M
>>>>> [213389.312327]  kill_f2fs_super+0x76/0xe0 [f2fs]^M
>>>>> [213389.314014]  deactivate_locked_super+0x3b/0x80^M
>>>>> [213389.315692]  deactivate_super+0x3e/0x50^M
>>>>> [213389.317226]  cleanup_mnt+0x109/0x160^M
>>>>> [213389.318718]  __cleanup_mnt+0x12/0x20^M
>>>>> [213389.320177]  task_work_run+0x70/0xb0^M
>>>>> [213389.321609]  exit_to_usermode_loop+0x131/0x160^M
>>>>> [213389.323306]  do_syscall_64+0x170/0x1b0^M
>>>>> [213389.324762]  entry_SYSCALL_64_after_hwframe+0x44/0xa9^M
>>>>> [213389.326477] RIP: 0033:0x7fc4b5e6a35b^M
>>>>
>>>> Does this only happen during umount? If so, will below change help?
>>>>
>>>> 	if ((S_ISDIR(inode->i_mode) || IS_NOQUOTA(inode)) &&
>>>> +			!is_sbi_flag_set(sbi, SBI_IS_CLOSE) &&
>>>> 			wbc->sync_mode == WB_SYNC_NONE &&
>>>> 			get_dirty_pages(inode) < nr_pages_to_skip(sbi, DATA) &&
>>>> 			f2fs_available_free_memory(sbi, DIRTY_DENTS))
>>>> 		goto skip_write;
>>>
>>> Hmm, this doesn't work. The writeback was called before put_super?
>>
>> Oops, still be confused about this issue. :(
> 
> Huam, I hit the problem with the patch.
> I need to return back and think in other way. :(

Still quota data was left? what about dentry?

Thanks,

> 
>>
>> Thanks,
>>
>>> I'll try the original patch one more time.
>>>
>>>>
>>>>>
>>>>>>
>>>>>> Still I'm confused that why directory's data written could be skipped, but
>>>>>> quota's data couldn't, what's the difference?
>>>>>
>>>>> I suspect different blocking timing from cp_error between quota and dentry.
>>>>> e.g., we block dir operations right after cp_error, while quota can make
>>>>
>>>> No guarantee that there is no dirty dentry being created after
>>>> cp_error, right?
>>>>
>>>> e.g.
>>>>
>>>> Thread A				Thread B
>>>> - f2fs_create
>>>> - bypass f2fs_cp_error
>>>> 					- set cp_error
>>>> - create dirty dentry
>>>>
>>>> BTW, do you know what __writeback_inodes_sb_nr is waiting for?
>>>>
>>>>> dirty pages in more fine granularity.
>>>>>
>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>>
>>>>>>>>>
>>>>>>>>> Thanks,
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Thanks,
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
>>>>>>>>>>> ---
>>>>>>>>>>>  fs/f2fs/data.c | 2 +-
>>>>>>>>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>>>>>>>
>>>>>>>>>>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
>>>>>>>>>>> index 44645f4f914b6..72e8b50e588c1 100644
>>>>>>>>>>> --- a/fs/f2fs/data.c
>>>>>>>>>>> +++ b/fs/f2fs/data.c
>>>>>>>>>>> @@ -3148,7 +3148,7 @@ static int __f2fs_write_data_pages(struct address_space *mapping,
>>>>>>>>>>>  	if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING)))
>>>>>>>>>>>  		goto skip_write;
>>>>>>>>>>>  
>>>>>>>>>>> -	if ((S_ISDIR(inode->i_mode) || IS_NOQUOTA(inode)) &&
>>>>>>>>>>> +	if (S_ISDIR(inode->i_mode) &&
>>>>>>>>>>>  			wbc->sync_mode == WB_SYNC_NONE &&
>>>>>>>>>>>  			get_dirty_pages(inode) < nr_pages_to_skip(sbi, DATA) &&
>>>>>>>>>>>  			f2fs_available_free_memory(sbi, DIRTY_DENTS))
>>>>>>>>>>>
>>>>>>>>> .
>>>>>>>>>
>>>>>>> .
>>>>>>>
>>>>> .
>>>>>
>>> .
>>>
> .
> 


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH] f2fs: don't skip writeback of quota data
  2020-07-16  1:08                     ` Chao Yu
@ 2020-07-16  1:10                       ` Jaegeuk Kim
  2020-07-16  1:17                         ` Chao Yu
  0 siblings, 1 reply; 15+ messages in thread
From: Jaegeuk Kim @ 2020-07-16  1:10 UTC (permalink / raw)
  To: Chao Yu; +Cc: kernel-team, linux-kernel, linux-f2fs-devel

On 07/16, Chao Yu wrote:
> On 2020/7/16 3:10, Jaegeuk Kim wrote:
> > On 07/14, Chao Yu wrote:
> >> On 2020/7/14 1:59, Jaegeuk Kim wrote:
> >>> On 07/10, Chao Yu wrote:
> >>>> On 2020/7/10 11:50, Jaegeuk Kim wrote:
> >>>>> On 07/10, Chao Yu wrote:
> >>>>>> On 2020/7/10 11:26, Jaegeuk Kim wrote:
> >>>>>>> On 07/10, Chao Yu wrote:
> >>>>>>>> On 2020/7/10 3:05, Jaegeuk Kim wrote:
> >>>>>>>>> On 07/09, Chao Yu wrote:
> >>>>>>>>>> On 2020/7/9 13:30, Jaegeuk Kim wrote:
> >>>>>>>>>>> It doesn't need to bypass flushing quota data in background.
> >>>>>>>>>>
> >>>>>>>>>> The condition is used to flush quota data in batch to avoid random
> >>>>>>>>>> small-sized udpate, did you hit any problem here?
> >>>>>>>>>
> >>>>>>>>> I suspect this causes fault injection test being stuck by waiting for inode
> >>>>>>>>> writeback completion. With this patch, it has been running w/o any issue so far.
> >>>>>>>>> I keep an eye on this.
> >>>>>>>>
> >>>>>>>> Hmmm.. so that this patch may not fix the root cause, and it may hiding the
> >>>>>>>> issue deeper.
> >>>>>>>>
> >>>>>>>> How about just keeping this patch in our private branch to let fault injection
> >>>>>>>> test not be stuck? until we find the root cause in upstream codes.
> >>>>>>>
> >>>>>>> Well, I don't think this hides something. When the issue happens, I saw inodes
> >>>>>>> being stuck due to writeback while only quota has some dirty data. At that time,
> >>>>>>> there was no dirty data page from other inodes.
> >>>>>>
> >>>>>> Okay,
> >>>>>>
> >>>>>>>
> >>>>>>> More specifically, I suspect __writeback_inodes_sb_nr() gives WB_SYNC_NONE and
> >>>>>>> waits for wb_wait_for_completion().
> >>>>>>
> >>>>>> Did you record any callstack after the issue happened?
> >>>>>
> >>>>> I found this.
> >>>>>
> >>>>> [213389.297642]  __schedule+0x2dd/0x780^M
> >>>>> [213389.299224]  schedule+0x55/0xc0^M
> >>>>> [213389.300745]  wb_wait_for_completion+0x56/0x90^M
> >>>>> [213389.302469]  ? wait_woken+0x80/0x80^M
> >>>>> [213389.303997]  __writeback_inodes_sb_nr+0xa8/0xd0^M
> >>>>> [213389.305760]  writeback_inodes_sb+0x4b/0x60^M
> >>>>> [213389.307439]  sync_filesystem+0x2e/0xa0^M
> >>>>> [213389.308999]  generic_shutdown_super+0x27/0x110^M
> >>>>> [213389.310738]  kill_block_super+0x27/0x50^M
> >>>>> [213389.312327]  kill_f2fs_super+0x76/0xe0 [f2fs]^M
> >>>>> [213389.314014]  deactivate_locked_super+0x3b/0x80^M
> >>>>> [213389.315692]  deactivate_super+0x3e/0x50^M
> >>>>> [213389.317226]  cleanup_mnt+0x109/0x160^M
> >>>>> [213389.318718]  __cleanup_mnt+0x12/0x20^M
> >>>>> [213389.320177]  task_work_run+0x70/0xb0^M
> >>>>> [213389.321609]  exit_to_usermode_loop+0x131/0x160^M
> >>>>> [213389.323306]  do_syscall_64+0x170/0x1b0^M
> >>>>> [213389.324762]  entry_SYSCALL_64_after_hwframe+0x44/0xa9^M
> >>>>> [213389.326477] RIP: 0033:0x7fc4b5e6a35b^M
> >>>>
> >>>> Does this only happen during umount? If so, will below change help?
> >>>>
> >>>> 	if ((S_ISDIR(inode->i_mode) || IS_NOQUOTA(inode)) &&
> >>>> +			!is_sbi_flag_set(sbi, SBI_IS_CLOSE) &&
> >>>> 			wbc->sync_mode == WB_SYNC_NONE &&
> >>>> 			get_dirty_pages(inode) < nr_pages_to_skip(sbi, DATA) &&
> >>>> 			f2fs_available_free_memory(sbi, DIRTY_DENTS))
> >>>> 		goto skip_write;
> >>>
> >>> Hmm, this doesn't work. The writeback was called before put_super?
> >>
> >> Oops, still be confused about this issue. :(
> > 
> > Huam, I hit the problem with the patch.
> > I need to return back and think in other way. :(
> 
> Still quota data was left? what about dentry?

Huh, at this time, only node and meta pages were left as dirty.

> 
> Thanks,
> 
> > 
> >>
> >> Thanks,
> >>
> >>> I'll try the original patch one more time.
> >>>
> >>>>
> >>>>>
> >>>>>>
> >>>>>> Still I'm confused that why directory's data written could be skipped, but
> >>>>>> quota's data couldn't, what's the difference?
> >>>>>
> >>>>> I suspect different blocking timing from cp_error between quota and dentry.
> >>>>> e.g., we block dir operations right after cp_error, while quota can make
> >>>>
> >>>> No guarantee that there is no dirty dentry being created after
> >>>> cp_error, right?
> >>>>
> >>>> e.g.
> >>>>
> >>>> Thread A				Thread B
> >>>> - f2fs_create
> >>>> - bypass f2fs_cp_error
> >>>> 					- set cp_error
> >>>> - create dirty dentry
> >>>>
> >>>> BTW, do you know what __writeback_inodes_sb_nr is waiting for?
> >>>>
> >>>>> dirty pages in more fine granularity.
> >>>>>
> >>>>>>
> >>>>>>>
> >>>>>>>>
> >>>>>>>> Thanks,
> >>>>>>>>
> >>>>>>>>>
> >>>>>>>>> Thanks,
> >>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>> Thanks,
> >>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> >>>>>>>>>>> ---
> >>>>>>>>>>>  fs/f2fs/data.c | 2 +-
> >>>>>>>>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>>>>>>>>>>
> >>>>>>>>>>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> >>>>>>>>>>> index 44645f4f914b6..72e8b50e588c1 100644
> >>>>>>>>>>> --- a/fs/f2fs/data.c
> >>>>>>>>>>> +++ b/fs/f2fs/data.c
> >>>>>>>>>>> @@ -3148,7 +3148,7 @@ static int __f2fs_write_data_pages(struct address_space *mapping,
> >>>>>>>>>>>  	if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING)))
> >>>>>>>>>>>  		goto skip_write;
> >>>>>>>>>>>  
> >>>>>>>>>>> -	if ((S_ISDIR(inode->i_mode) || IS_NOQUOTA(inode)) &&
> >>>>>>>>>>> +	if (S_ISDIR(inode->i_mode) &&
> >>>>>>>>>>>  			wbc->sync_mode == WB_SYNC_NONE &&
> >>>>>>>>>>>  			get_dirty_pages(inode) < nr_pages_to_skip(sbi, DATA) &&
> >>>>>>>>>>>  			f2fs_available_free_memory(sbi, DIRTY_DENTS))
> >>>>>>>>>>>
> >>>>>>>>> .
> >>>>>>>>>
> >>>>>>> .
> >>>>>>>
> >>>>> .
> >>>>>
> >>> .
> >>>
> > .
> > 


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH] f2fs: don't skip writeback of quota data
  2020-07-16  1:10                       ` Jaegeuk Kim
@ 2020-07-16  1:17                         ` Chao Yu
  0 siblings, 0 replies; 15+ messages in thread
From: Chao Yu @ 2020-07-16  1:17 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: kernel-team, linux-kernel, linux-f2fs-devel

On 2020/7/16 9:10, Jaegeuk Kim wrote:
> On 07/16, Chao Yu wrote:
>> On 2020/7/16 3:10, Jaegeuk Kim wrote:
>>> On 07/14, Chao Yu wrote:
>>>> On 2020/7/14 1:59, Jaegeuk Kim wrote:
>>>>> On 07/10, Chao Yu wrote:
>>>>>> On 2020/7/10 11:50, Jaegeuk Kim wrote:
>>>>>>> On 07/10, Chao Yu wrote:
>>>>>>>> On 2020/7/10 11:26, Jaegeuk Kim wrote:
>>>>>>>>> On 07/10, Chao Yu wrote:
>>>>>>>>>> On 2020/7/10 3:05, Jaegeuk Kim wrote:
>>>>>>>>>>> On 07/09, Chao Yu wrote:
>>>>>>>>>>>> On 2020/7/9 13:30, Jaegeuk Kim wrote:
>>>>>>>>>>>>> It doesn't need to bypass flushing quota data in background.
>>>>>>>>>>>>
>>>>>>>>>>>> The condition is used to flush quota data in batch to avoid random
>>>>>>>>>>>> small-sized udpate, did you hit any problem here?
>>>>>>>>>>>
>>>>>>>>>>> I suspect this causes fault injection test being stuck by waiting for inode
>>>>>>>>>>> writeback completion. With this patch, it has been running w/o any issue so far.
>>>>>>>>>>> I keep an eye on this.
>>>>>>>>>>
>>>>>>>>>> Hmmm.. so that this patch may not fix the root cause, and it may hiding the
>>>>>>>>>> issue deeper.
>>>>>>>>>>
>>>>>>>>>> How about just keeping this patch in our private branch to let fault injection
>>>>>>>>>> test not be stuck? until we find the root cause in upstream codes.
>>>>>>>>>
>>>>>>>>> Well, I don't think this hides something. When the issue happens, I saw inodes
>>>>>>>>> being stuck due to writeback while only quota has some dirty data. At that time,
>>>>>>>>> there was no dirty data page from other inodes.
>>>>>>>>
>>>>>>>> Okay,
>>>>>>>>
>>>>>>>>>
>>>>>>>>> More specifically, I suspect __writeback_inodes_sb_nr() gives WB_SYNC_NONE and
>>>>>>>>> waits for wb_wait_for_completion().
>>>>>>>>
>>>>>>>> Did you record any callstack after the issue happened?
>>>>>>>
>>>>>>> I found this.
>>>>>>>
>>>>>>> [213389.297642]  __schedule+0x2dd/0x780^M
>>>>>>> [213389.299224]  schedule+0x55/0xc0^M
>>>>>>> [213389.300745]  wb_wait_for_completion+0x56/0x90^M
>>>>>>> [213389.302469]  ? wait_woken+0x80/0x80^M
>>>>>>> [213389.303997]  __writeback_inodes_sb_nr+0xa8/0xd0^M
>>>>>>> [213389.305760]  writeback_inodes_sb+0x4b/0x60^M
>>>>>>> [213389.307439]  sync_filesystem+0x2e/0xa0^M
>>>>>>> [213389.308999]  generic_shutdown_super+0x27/0x110^M
>>>>>>> [213389.310738]  kill_block_super+0x27/0x50^M
>>>>>>> [213389.312327]  kill_f2fs_super+0x76/0xe0 [f2fs]^M
>>>>>>> [213389.314014]  deactivate_locked_super+0x3b/0x80^M
>>>>>>> [213389.315692]  deactivate_super+0x3e/0x50^M
>>>>>>> [213389.317226]  cleanup_mnt+0x109/0x160^M
>>>>>>> [213389.318718]  __cleanup_mnt+0x12/0x20^M
>>>>>>> [213389.320177]  task_work_run+0x70/0xb0^M
>>>>>>> [213389.321609]  exit_to_usermode_loop+0x131/0x160^M
>>>>>>> [213389.323306]  do_syscall_64+0x170/0x1b0^M
>>>>>>> [213389.324762]  entry_SYSCALL_64_after_hwframe+0x44/0xa9^M
>>>>>>> [213389.326477] RIP: 0033:0x7fc4b5e6a35b^M
>>>>>>
>>>>>> Does this only happen during umount? If so, will below change help?
>>>>>>
>>>>>> 	if ((S_ISDIR(inode->i_mode) || IS_NOQUOTA(inode)) &&
>>>>>> +			!is_sbi_flag_set(sbi, SBI_IS_CLOSE) &&
>>>>>> 			wbc->sync_mode == WB_SYNC_NONE &&
>>>>>> 			get_dirty_pages(inode) < nr_pages_to_skip(sbi, DATA) &&
>>>>>> 			f2fs_available_free_memory(sbi, DIRTY_DENTS))
>>>>>> 		goto skip_write;
>>>>>
>>>>> Hmm, this doesn't work. The writeback was called before put_super?
>>>>
>>>> Oops, still be confused about this issue. :(
>>>
>>> Huam, I hit the problem with the patch.
>>> I need to return back and think in other way. :(
>>
>> Still quota data was left? what about dentry?
> 
> Huh, at this time, only node and meta pages were left as dirty.

I saw both meta and node's writepages() called from background will skip
flushing dirty pages if dirty page count didn't touch the threshold.

	/* collect a number of dirty node pages and write together */
	if (wbc->sync_mode != WB_SYNC_ALL &&
			get_pages(sbi, F2FS_DIRTY_NODES) <
					nr_pages_to_skip(sbi, NODE))
		goto skip_write;

	/* collect a number of dirty meta pages and write together */
	if (wbc->sync_mode != WB_SYNC_ALL &&
			get_pages(sbi, F2FS_DIRTY_META) <
					nr_pages_to_skip(sbi, META))
		goto skip_write;

At that time, would syncfs (type sync command via shell) help?

> 
>>
>> Thanks,
>>
>>>
>>>>
>>>> Thanks,
>>>>
>>>>> I'll try the original patch one more time.
>>>>>
>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> Still I'm confused that why directory's data written could be skipped, but
>>>>>>>> quota's data couldn't, what's the difference?
>>>>>>>
>>>>>>> I suspect different blocking timing from cp_error between quota and dentry.
>>>>>>> e.g., we block dir operations right after cp_error, while quota can make
>>>>>>
>>>>>> No guarantee that there is no dirty dentry being created after
>>>>>> cp_error, right?
>>>>>>
>>>>>> e.g.
>>>>>>
>>>>>> Thread A				Thread B
>>>>>> - f2fs_create
>>>>>> - bypass f2fs_cp_error
>>>>>> 					- set cp_error
>>>>>> - create dirty dentry
>>>>>>
>>>>>> BTW, do you know what __writeback_inodes_sb_nr is waiting for?
>>>>>>
>>>>>>> dirty pages in more fine granularity.
>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Thanks,
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Thanks,
>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Thanks,
>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
>>>>>>>>>>>>> ---
>>>>>>>>>>>>>  fs/f2fs/data.c | 2 +-
>>>>>>>>>>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>>>>>>>>>
>>>>>>>>>>>>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
>>>>>>>>>>>>> index 44645f4f914b6..72e8b50e588c1 100644
>>>>>>>>>>>>> --- a/fs/f2fs/data.c
>>>>>>>>>>>>> +++ b/fs/f2fs/data.c
>>>>>>>>>>>>> @@ -3148,7 +3148,7 @@ static int __f2fs_write_data_pages(struct address_space *mapping,
>>>>>>>>>>>>>  	if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING)))
>>>>>>>>>>>>>  		goto skip_write;
>>>>>>>>>>>>>  
>>>>>>>>>>>>> -	if ((S_ISDIR(inode->i_mode) || IS_NOQUOTA(inode)) &&
>>>>>>>>>>>>> +	if (S_ISDIR(inode->i_mode) &&
>>>>>>>>>>>>>  			wbc->sync_mode == WB_SYNC_NONE &&
>>>>>>>>>>>>>  			get_dirty_pages(inode) < nr_pages_to_skip(sbi, DATA) &&
>>>>>>>>>>>>>  			f2fs_available_free_memory(sbi, DIRTY_DENTS))
>>>>>>>>>>>>>
>>>>>>>>>>> .
>>>>>>>>>>>
>>>>>>>>> .
>>>>>>>>>
>>>>>>> .
>>>>>>>
>>>>> .
>>>>>
>>> .
>>>
> .
> 


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

end of thread, back to index

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-09  5:30 [f2fs-dev] [PATCH] f2fs: don't skip writeback of quota data Jaegeuk Kim
2020-07-09  7:10 ` Chao Yu
2020-07-09 19:05   ` Jaegeuk Kim
2020-07-10  3:15     ` Chao Yu
2020-07-10  3:26       ` Jaegeuk Kim
2020-07-10  3:41         ` Chao Yu
2020-07-10  3:50           ` Jaegeuk Kim
2020-07-10  7:31             ` Chao Yu
2020-07-10  8:16               ` Jaegeuk Kim
2020-07-13 17:59               ` Jaegeuk Kim
2020-07-14 12:14                 ` Chao Yu
2020-07-15 19:10                   ` Jaegeuk Kim
2020-07-16  1:08                     ` Chao Yu
2020-07-16  1:10                       ` Jaegeuk Kim
2020-07-16  1:17                         ` Chao Yu

Linux-f2fs-devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-f2fs-devel/0 linux-f2fs-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-f2fs-devel linux-f2fs-devel/ https://lore.kernel.org/linux-f2fs-devel \
		linux-f2fs-devel@lists.sourceforge.net
	public-inbox-index linux-f2fs-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/net.sourceforge.lists.linux-f2fs-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git