[PATCH] qgroup: Prevent qgroup->reserved from going subzero

2016-09-30 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues While free'ing qgroup->reserved resources, we much check if the page has not been invalidated by a truncate operation by checking if the page is still dirty before reducing the qgroup resources. Resources in such a case are free'd when the entire extent is released by dela

Re: [PATCH] qgroup: Prevent qgroup->reserved from going subzero

2016-09-29 Thread Qu Wenruo
At 09/30/2016 10:18 AM, Qu Wenruo wrote: Your original fix is good. Feel free to my tag after enriching the comment in btrfs_invalidatepage(). Feel free to "add" my tag... Reviewed-by: Qu Wenruo Thanks again for your founding and sorry for the extra time reviewing. for your "finding"...

Re: [PATCH] qgroup: Prevent qgroup->reserved from going subzero

2016-09-29 Thread Qu Wenruo
Your original fix is good. Feel free to my tag after enriching the comment in btrfs_invalidatepage(). Reviewed-by: Qu Wenruo Thanks again for your founding and sorry for the extra time reviewing. Thanks Qu At 09/29/2016 07:13 PM, Goldwyn Rodrigues wrote: On 09/29/2016 03:57 AM, Qu Wenruo

Re: [PATCH] qgroup: Prevent qgroup->reserved from going subzero

2016-09-29 Thread Qu Wenruo
At 09/29/2016 07:13 PM, Goldwyn Rodrigues wrote: On 09/29/2016 03:57 AM, Qu Wenruo wrote: Thanks for your test script. I succeeded in pinning down the problem. The problem is, btrfs is invalidate pages that belongs to ordered extent(goes through writeback) No, I don't think invalidated

Re: [PATCH] qgroup: Prevent qgroup->reserved from going subzero

2016-09-29 Thread Goldwyn Rodrigues
On 09/29/2016 03:57 AM, Qu Wenruo wrote: > Thanks for your test script. > > I succeeded in pinning down the problem. > > The problem is, btrfs is invalidate pages that belongs to ordered > extent(goes through writeback) No, I don't think invalidated pages are going through writeback. The prob

Re: [PATCH] qgroup: Prevent qgroup->reserved from going subzero

2016-09-29 Thread Qu Wenruo
Thanks for your test script. I succeeded in pinning down the problem. The problem is, btrfs is invalidate pages that belongs to ordered extent(goes through writeback) The ftrace(with more tracepoints to trace qgroup->reserved change) shows: -- btrfs_qgroup_release_data: root=257, ino=257,

Re: [PATCH] qgroup: Prevent qgroup->reserved from going subzero

2016-09-27 Thread Goldwyn Rodrigues
On 09/27/2016 08:44 PM, Qu Wenruo wrote: > Finally reproduced it. > > Although in a low chance, about 1/10. > > Under most case, the final remove gets executed without error. Change 50m to 500m while setting the qgroup limit, the probability will increase. -- Goldwyn -- To unsubscribe fro

Re: [PATCH] qgroup: Prevent qgroup->reserved from going subzero

2016-09-27 Thread Qu Wenruo
At 09/27/2016 10:04 PM, Goldwyn Rodrigues wrote: On 09/26/2016 10:10 PM, Qu Wenruo wrote: At 09/26/2016 10:31 PM, Goldwyn Rodrigues wrote: On 09/25/2016 09:33 PM, Qu Wenruo wrote: At 09/23/2016 09:43 PM, Goldwyn Rodrigues wrote: [snipped] Sorry I still don't get the point. Woul

Re: [PATCH] qgroup: Prevent qgroup->reserved from going subzero

2016-09-27 Thread Goldwyn Rodrigues
On 09/26/2016 10:10 PM, Qu Wenruo wrote: > > > At 09/26/2016 10:31 PM, Goldwyn Rodrigues wrote: >> >> >> On 09/25/2016 09:33 PM, Qu Wenruo wrote: >>> >>> >>> At 09/23/2016 09:43 PM, Goldwyn Rodrigues wrote: > [snipped] >>> >>> Sorry I still don't get the point. >>> Would you please gi

Re: [PATCH] qgroup: Prevent qgroup->reserved from going subzero

2016-09-26 Thread Qu Wenruo
At 09/26/2016 10:31 PM, Goldwyn Rodrigues wrote: On 09/25/2016 09:33 PM, Qu Wenruo wrote: At 09/23/2016 09:43 PM, Goldwyn Rodrigues wrote: [snipped] Sorry I still don't get the point. Would you please give a call flow of the timing dirtying page and calling btrfs_qgroup_reserve/free/

Re: [PATCH] qgroup: Prevent qgroup->reserved from going subzero

2016-09-26 Thread Goldwyn Rodrigues
On 09/25/2016 09:33 PM, Qu Wenruo wrote: > > > At 09/23/2016 09:43 PM, Goldwyn Rodrigues wrote: >> >> >> On 09/22/2016 08:06 PM, Qu Wenruo wrote: >>> >>> >>> At 09/23/2016 02:47 AM, Goldwyn Rodrigues wrote: From: Goldwyn Rodrigues While free'ing qgroup->reserved resources, we mu

Re: [PATCH] qgroup: Prevent qgroup->reserved from going subzero

2016-09-25 Thread Qu Wenruo
At 09/23/2016 09:43 PM, Goldwyn Rodrigues wrote: On 09/22/2016 08:06 PM, Qu Wenruo wrote: At 09/23/2016 02:47 AM, Goldwyn Rodrigues wrote: From: Goldwyn Rodrigues While free'ing qgroup->reserved resources, we must check if the page is already commmitted to disk or still in memory. If no

Re: [PATCH] qgroup: Prevent qgroup->reserved from going subzero

2016-09-23 Thread Goldwyn Rodrigues
On 09/22/2016 08:06 PM, Qu Wenruo wrote: > > > At 09/23/2016 02:47 AM, Goldwyn Rodrigues wrote: >> From: Goldwyn Rodrigues >> >> While free'ing qgroup->reserved resources, we must check >> if the page is already commmitted to disk or still in memory. >> If not, the reserve free is doubly accou

Re: [PATCH] qgroup: Prevent qgroup->reserved from going subzero

2016-09-22 Thread Qu Wenruo
At 09/23/2016 02:47 AM, Goldwyn Rodrigues wrote: From: Goldwyn Rodrigues While free'ing qgroup->reserved resources, we must check if the page is already commmitted to disk or still in memory. If not, the reserve free is doubly accounted, once while invalidating the page, and the next time whi

[PATCH] qgroup: Prevent qgroup->reserved from going subzero

2016-09-22 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues While free'ing qgroup->reserved resources, we must check if the page is already commmitted to disk or still in memory. If not, the reserve free is doubly accounted, once while invalidating the page, and the next time while free'ing delalloc. This results is qgroup->reserve