Re: kernel BUG at fs/ext4/inode.c:LINE!

2020-11-25 Thread Linus Torvalds
On Wed, Nov 25, 2020 at 1:30 PM Linus Torvalds wrote: > > I'm not sure I'm willing to write and test the real patch, but it > doesn't look _too_ nasty from just looking at the code. The bookmark > thing makes it important to only actually clear the bit at the end (as > does the handoff case

Re: kernel BUG at fs/ext4/inode.c:LINE!

2020-11-25 Thread Linus Torvalds
On Tue, Nov 24, 2020 at 3:24 PM Linus Torvalds wrote: > > I've applied your second patch (the smaller one that just takes a ref > around the critical section). If somebody comes up with some great > alternative, we can always revisit this. Hmm. I'm not sure about "great alternative", but it

Re: kernel BUG at fs/ext4/inode.c:LINE!

2020-11-25 Thread Jan Kara
On Tue 24-11-20 12:19:12, Matthew Wilcox wrote: > On Mon, Nov 23, 2020 at 08:07:24PM -0800, Hugh Dickins wrote: > > Twice now, when exercising ext4 looped on shmem huge pages, I have crashed > > on the PF_ONLY_HEAD check inside PageWaiters(): ext4_finish_bio() calling > > end_page_writeback()

Re: kernel BUG at fs/ext4/inode.c:LINE!

2020-11-24 Thread Linus Torvalds
On Tue, Nov 24, 2020 at 1:47 PM Hugh Dickins wrote: > > I think the unreferenced struct page asks for trouble. I do agree. I've applied your second patch (the smaller one that just takes a ref around the critical section). If somebody comes up with some great alternative, we can always revisit

Re: kernel BUG at fs/ext4/inode.c:LINE!

2020-11-24 Thread Hugh Dickins
On Tue, 24 Nov 2020, Linus Torvalds wrote: > On Tue, Nov 24, 2020 at 12:16 PM Matthew Wilcox wrote: > > > > So my s/if/while/ suggestion is wrong and we need to do something to > > prevent spurious wakeups. Unless we bury the spurious wakeup logic > > inside wait_on_page_writeback() ... > > We

Re: kernel BUG at fs/ext4/inode.c:LINE!

2020-11-24 Thread Linus Torvalds
On Tue, Nov 24, 2020 at 12:16 PM Matthew Wilcox wrote: > > So my s/if/while/ suggestion is wrong and we need to do something to > prevent spurious wakeups. Unless we bury the spurious wakeup logic > inside wait_on_page_writeback() ... We can certainly make the "if()" in that loop be a

Re: kernel BUG at fs/ext4/inode.c:LINE!

2020-11-24 Thread Matthew Wilcox
On Tue, Nov 24, 2020 at 11:00:42AM -0800, Linus Torvalds wrote: > On Tue, Nov 24, 2020 at 10:33 AM Matthew Wilcox wrote: > > > > We could fix this by turning that 'if' into a 'while' in > > write_cache_pages(). > > That might be the simplest patch indeed. > > At the same time, I do worry about

Re: kernel BUG at fs/ext4/inode.c:LINE!

2020-11-24 Thread Linus Torvalds
On Tue, Nov 24, 2020 at 10:33 AM Matthew Wilcox wrote: > > We could fix this by turning that 'if' into a 'while' in > write_cache_pages(). That might be the simplest patch indeed. At the same time, I do worry about other cases like this: while spurious wakeup events are normal and happen in

Re: kernel BUG at fs/ext4/inode.c:LINE!

2020-11-24 Thread Matthew Wilcox
On Tue, Nov 24, 2020 at 08:28:16AM -0800, Hugh Dickins wrote: > On Tue, 24 Nov 2020, Matthew Wilcox wrote: > > On Mon, Nov 23, 2020 at 08:07:24PM -0800, Hugh Dickins wrote: > > > > > > Then on crashing a second time, realized there's a stronger reason against > > > that approach. If my testing

Re: kernel BUG at fs/ext4/inode.c:LINE!

2020-11-24 Thread Hugh Dickins
On Mon, 23 Nov 2020, Hugh Dickins wrote: > On Mon, 23 Nov 2020, Linus Torvalds wrote: > > > > IOW, why couldn't we just make the __test_set_page_writeback() > > increment the page count if the writeback flag wasn't already set, and > > then make the end_page_writeback() do a put_page() after it

Re: kernel BUG at fs/ext4/inode.c:LINE!

2020-11-24 Thread Hugh Dickins
On Tue, 24 Nov 2020, Matthew Wilcox wrote: > On Mon, Nov 23, 2020 at 08:07:24PM -0800, Hugh Dickins wrote: > > > > Then on crashing a second time, realized there's a stronger reason against > > that approach. If my testing just occasionally crashes on that check, > > when the page is reused for

Re: kernel BUG at fs/ext4/inode.c:LINE!

2020-11-24 Thread Matthew Wilcox
On Mon, Nov 23, 2020 at 08:07:24PM -0800, Hugh Dickins wrote: > Twice now, when exercising ext4 looped on shmem huge pages, I have crashed > on the PF_ONLY_HEAD check inside PageWaiters(): ext4_finish_bio() calling > end_page_writeback() calling wake_up_page() on tail of a shmem huge page, > no

Re: kernel BUG at fs/ext4/inode.c:LINE!

2020-11-23 Thread Hugh Dickins
On Mon, 23 Nov 2020, Linus Torvalds wrote: > On Mon, Nov 23, 2020 at 8:07 PM Hugh Dickins wrote: > > > > The problem is that PageWriteback is not accompanied by a page reference > > (as the NOTE at the end of test_clear_page_writeback() acknowledges): as > > soon as TestClearPageWriteback has

Re: kernel BUG at fs/ext4/inode.c:LINE!

2020-11-23 Thread Linus Torvalds
On Mon, Nov 23, 2020 at 8:07 PM Hugh Dickins wrote: > > Then on crashing a second time, realized there's a stronger reason against > that approach. If my testing just occasionally crashes on that check, > when the page is reused for part of a compound page, wouldn't it be much > more common for

Re: kernel BUG at fs/ext4/inode.c:LINE!

2020-11-23 Thread Linus Torvalds
On Mon, Nov 23, 2020 at 8:07 PM Hugh Dickins wrote: > > The problem is that PageWriteback is not accompanied by a page reference > (as the NOTE at the end of test_clear_page_writeback() acknowledges): as > soon as TestClearPageWriteback has been done, that page could be removed > from page cache,

Re: kernel BUG at fs/ext4/inode.c:LINE!

2020-11-23 Thread Hugh Dickins
On Mon, 30 Aug 2020, Linus Torvalds wrote: > On Mon, Aug 31, 2020 at 3:03 AM Jan Kara wrote: > > > > On Fri 28-08-20 12:07:55, Jan Kara wrote: > > > > > > Doh, so this is: > > > > > > wait_on_page_writeback(page); > > > >>> BUG_ON(PageWriteback(page));

Re: kernel BUG at fs/ext4/inode.c:LINE!

2020-08-31 Thread Linus Torvalds
On Mon, Aug 31, 2020 at 3:03 AM Jan Kara wrote: > > On Fri 28-08-20 12:07:55, Jan Kara wrote: > > > > Doh, so this is: > > > > wait_on_page_writeback(page); > > >>> BUG_ON(PageWriteback(page)); > > > > in mpage_prepare_extent_to_map(). So we have

Re: kernel BUG at fs/ext4/inode.c:LINE!

2020-08-31 Thread Jan Kara
On Fri 28-08-20 12:07:55, Jan Kara wrote: > On Wed 26-08-20 19:48:16, syzbot wrote: > > Hello, > > > > syzbot found the following issue on: > > > > HEAD commit:c3d8f220 Merge tag 'kbuild-fixes-v5.9' of git://git.kernel.. > > git tree: upstream > > console output:

Re: kernel BUG at fs/ext4/inode.c:LINE!

2020-08-28 Thread Jan Kara
On Wed 26-08-20 19:48:16, syzbot wrote: > Hello, > > syzbot found the following issue on: > > HEAD commit:c3d8f220 Merge tag 'kbuild-fixes-v5.9' of git://git.kernel.. > git tree: upstream > console output: https://syzkaller.appspot.com/x/log.txt?x=15f83cb690 > kernel config:

kernel BUG at fs/ext4/inode.c:LINE!

2020-08-26 Thread syzbot
Hello, syzbot found the following issue on: HEAD commit:c3d8f220 Merge tag 'kbuild-fixes-v5.9' of git://git.kernel.. git tree: upstream console output: https://syzkaller.appspot.com/x/log.txt?x=15f83cb690 kernel config: https://syzkaller.appspot.com/x/.config?x=bb68b9e8a8cc842f