From: Hillf Danton <hdanton@sina.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Genes Lists <lists@sapience.com>,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-mm@kvack.org
Subject: Re: 6.6.8 stable: crash in folio_mark_dirty
Date: Mon, 1 Jan 2024 19:33:16 +0800 [thread overview]
Message-ID: <20240101113316.2595-1-hdanton@sina.com> (raw)
In-Reply-To: <ZZKA6Phgfa78kM9I@casper.infradead.org>
On Mon, 1 Jan 2024 09:07:52 +0000 Matthew Wilcox
> On Mon, Jan 01, 2024 at 09:55:04AM +0800, Hillf Danton wrote:
> > On Sun, 31 Dec 2023 13:07:03 +0000 Matthew Wilcox <willy@infradead.org>
> > > I don't think this can happen. Look at the call trace;
> > > block_dirty_folio() is called from unmap_page_range(). That means the
> > > page is in the page tables. We unmap the pages in a folio from the
> > > page tables before we set folio->mapping to NULL. Look at
> > > invalidate_inode_pages2_range() for example:
> > >
> > > unmap_mapping_pages(mapping, indices[i],
> > > (1 + end - indices[i]), false);
> > > folio_lock(folio);
> > > folio_wait_writeback(folio);
> > > if (folio_mapped(folio))
> > > unmap_mapping_folio(folio);
> > > BUG_ON(folio_mapped(folio));
> > > if (!invalidate_complete_folio2(mapping, folio))
> > >
> > What is missed here is the same check [1] in invalidate_inode_pages2_range(),
> > so I built no wheel.
> >
> > folio_lock(folio);
> > if (unlikely(folio->mapping != mapping)) {
> > folio_unlock(folio);
> > continue;
> > }
> >
> > [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/mm/truncate.c#n658
>
> That's entirely different. That's checking in the truncate path whether
> somebody else already truncated this page. What I was showing was why
> a page found through a page table walk cannot have been truncated (which
> is actually quite interesting, because it's the page table lock that
> prevents the race).
>
Feel free to shed light on how ptl protects folio->mapping.
next prev parent reply other threads:[~2024-01-01 11:33 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-30 15:23 Genes Lists
2023-12-30 18:02 ` Matthew Wilcox
2023-12-30 19:16 ` Genes Lists
2023-12-31 1:28 ` Hillf Danton
2023-12-31 13:07 ` Matthew Wilcox
2024-01-01 1:55 ` Hillf Danton
2024-01-01 9:07 ` Matthew Wilcox
2024-01-01 11:33 ` Hillf Danton [this message]
2024-01-01 14:11 ` Matthew Wilcox
2024-01-03 10:49 ` Hillf Danton
2024-01-03 17:53 ` Matthew Wilcox
2023-12-31 20:59 ` Matthew Wilcox
2023-12-31 21:12 ` Genes Lists
2023-12-31 21:15 ` Genes Lists
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240101113316.2595-1-hdanton@sina.com \
--to=hdanton@sina.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lists@sapience.com \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox