Re: [PATCH] Btrfs: add another missing end_page_writeback on submit_extent_page failure

2017-02-08 Thread David Sterba
On Tue, Feb 07, 2017 at 12:14:51PM -0800, Liu Bo wrote: > > + end_page_writeback(page); > > + } > > > > cur = cur + iosize; > > pg_offset += iosize; > > @@ -3767,7 +3770,8 @@ static noinline_for_stack int write_one_eb(struct > >

Re: [PATCH] Btrfs: add another missing end_page_writeback on submit_extent_page failure

2017-02-07 Thread Liu Bo
On Tue, Feb 07, 2017 at 08:09:53PM +0900, takafumi-sslab wrote: > > On 2017/02/07 1:34, Liu Bo wrote: > > > > > One thing to add, we still need to check whether page has writeback bit > > before > > end_page_writeback. > > Ok, I add PageWriteback check before end_page_writeback. > > > > > >

Re: [PATCH] Btrfs: add another missing end_page_writeback on submit_extent_page failure

2017-02-07 Thread takafumi-sslab
On 2017/02/07 1:34, Liu Bo wrote: One thing to add, we still need to check whether page has writeback bit before end_page_writeback. Ok, I add PageWriteback check before end_page_writeback. Looks like commit 55e3bd2e0c2e1 also has the same problem although I gave it my reviewed-by. I

Re: [PATCH] Btrfs: add another missing end_page_writeback on submit_extent_page failure

2017-02-06 Thread Liu Bo
On Mon, Feb 06, 2017 at 08:26:54AM -0800, Liu Bo wrote: > On Mon, Feb 06, 2017 at 02:50:18PM +0900, takafumi-sslab wrote: > > > > > > On 2017/02/06 12:35, Liu Bo wrote: > > > a) __extent_writepage has handled the case when nr == 0. > > > > Yes, I agree this. > > > > > b) when nr == 1, the page

Re: [PATCH] Btrfs: add another missing end_page_writeback on submit_extent_page failure

2017-02-06 Thread Liu Bo
On Mon, Feb 06, 2017 at 02:50:18PM +0900, takafumi-sslab wrote: > > > On 2017/02/06 12:35, Liu Bo wrote: > > a) __extent_writepage has handled the case when nr == 0. > > Yes, I agree this. > > > b) when nr == 1, the page is marked with writeback bit and added into a > > bio, thus we have

Re: [PATCH] Btrfs: add another missing end_page_writeback on submit_extent_page failure

2017-02-06 Thread takafumi-sslab
I am sorry for forggeting to write the reproducing steps. I injects the ftrace's logging code and the fault to the Linux kerenl v4.10-rc7. The diff is too long for pasting here. So, I put the repository of the kernel here. https://github.com/tk1012/linux-for-reproduce-btrfs-failure.git And

Re: [PATCH] Btrfs: add another missing end_page_writeback on submit_extent_page failure

2017-02-05 Thread takafumi-sslab
On 2017/02/06 12:35, Liu Bo wrote: a) __extent_writepage has handled the case when nr == 0. Yes, I agree this. b) when nr == 1, the page is marked with writeback bit and added into a bio, thus we have bio_end to deal with page bits. However, I don't think this is always correct,

Re: [PATCH] Btrfs: add another missing end_page_writeback on submit_extent_page failure

2017-02-05 Thread Liu Bo
On Sat, Feb 04, 2017 at 09:42:17PM +0900, takafumi-sslab wrote: > > > (But it could be changed after subpagesize block patchset, and there is > > more work rather than just adding a end_page_writeback, e.g. writepage > > endio also needs to be updated). > > Ok... the discussion become

Re: [PATCH] Btrfs: add another missing end_page_writeback on submit_extent_page failure

2017-02-04 Thread takafumi-sslab
(But it could be changed after subpagesize block patchset, and there is more work rather than just adding a end_page_writeback, e.g. writepage endio also needs to be updated). Ok... the discussion become complicated. So, let me make this clear. you think a) this is a bug; we need to clear

Re: [PATCH] Btrfs: add another missing end_page_writeback on submit_extent_page failure

2017-02-01 Thread Liu Bo
On Wed, Feb 01, 2017 at 12:27:24PM +0900, takafumi-sslab wrote: > Thanks for your reply. > > I think you mentioned about the below if-block in __extent_writepage(). > > if (nr == 0) { > /* make sure the mapping tag for page dirty gets cleared */ > set_page_writeback(page); >

Re: [PATCH] Btrfs: add another missing end_page_writeback on submit_extent_page failure

2017-01-31 Thread takafumi-sslab
Thanks for your reply. I think you mentioned about the below if-block in __extent_writepage(). if (nr == 0) { /* make sure the mapping tag for page dirty gets cleared */ set_page_writeback(page); end_page_writeback(page); } However, this if-block only works when nr is

Re: [PATCH] Btrfs: add another missing end_page_writeback on submit_extent_page failure

2017-01-30 Thread Liu Bo
On Fri, Jan 13, 2017 at 03:12:31PM +0900, takafumi-sslab wrote: > Thanks for your replying. > > I understand this bug is more complicated than I expected. > I classify error cases under submit_extent_page() below > > A: ENOMEM error at btrfs_bio_alloc() in submit_extent_page() > I first assumed

Re: [PATCH] Btrfs: add another missing end_page_writeback on submit_extent_page failure

2017-01-12 Thread takafumi-sslab
Thanks for your replying. I understand this bug is more complicated than I expected. I classify error cases under submit_extent_page() below A: ENOMEM error at btrfs_bio_alloc() in submit_extent_page() I first assumed this case and sent the mail. When bio_ret is NULL, submit_extent_page() calls

Re: [PATCH] Btrfs: add another missing end_page_writeback on submit_extent_page failure

2016-12-21 Thread Liu Bo
On Fri, Dec 16, 2016 at 03:41:50PM +0900, Takafumi Kubota wrote: > This is actually inspired by Filipe's patch(55e3bd2e0c2e1). > > When submit_extent_page() in __extent_writepage_io() fails, > Btrfs misses clearing a writeback bit of the failed page. > This causes the false under-writeback page.

[PATCH] Btrfs: add another missing end_page_writeback on submit_extent_page failure

2016-12-15 Thread Takafumi Kubota
This is actually inspired by Filipe's patch(55e3bd2e0c2e1). When submit_extent_page() in __extent_writepage_io() fails, Btrfs misses clearing a writeback bit of the failed page. This causes the false under-writeback page. Then, another sync task hangs in filemap_fdatawait_range(), because it