linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Hillf Danton <hdanton@sina.com>
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: Sun, 31 Dec 2023 13:07:03 +0000	[thread overview]
Message-ID: <ZZFnd3tZZvg2eZun@casper.infradead.org> (raw)
In-Reply-To: <20231231012846.2355-1-hdanton@sina.com>

On Sun, Dec 31, 2023 at 09:28:46AM +0800, Hillf Danton wrote:
> On Sat, Dec 30, 2023 at 10:23:26AM -0500 Genes Lists <lists@sapience.com>
> > Apologies in advance, but I cannot git bisect this since machine was
> > running for 10 days on 6.6.8 before this happened.
> >
> > Dec 30 07:00:36 s6 kernel: ------------[ cut here ]------------
> > Dec 30 07:00:36 s6 kernel: WARNING: CPU: 0 PID: 521524 at mm/page-writeback.c:2668 __folio_mark_dirty (??:?) 
> > Dec 30 07:00:36 s6 kernel: CPU: 0 PID: 521524 Comm: rsync Not tainted 6.6.8-stable-1 #13 d238f5ab6a206cdb0cc5cd72f8688230f23d58df
> > Dec 30 07:00:36 s6 kernel: block_dirty_folio (??:?) 
> > Dec 30 07:00:36 s6 kernel: unmap_page_range (??:?) 
> > Dec 30 07:00:36 s6 kernel: unmap_vmas (??:?) 
> > Dec 30 07:00:36 s6 kernel: exit_mmap (??:?) 
> > Dec 30 07:00:36 s6 kernel: __mmput (??:?) 
> > Dec 30 07:00:36 s6 kernel: do_exit (??:?) 
> > Dec 30 07:00:36 s6 kernel: do_group_exit (??:?) 
> > Dec 30 07:00:36 s6 kernel: __x64_sys_exit_group (??:?) 
> > Dec 30 07:00:36 s6 kernel: do_syscall_64 (??:?) 
> 
> See what comes out if race is handled.
> Only for thoughts.

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))

... and invalidate_complete_folio2() is where we set ->mapping to NULL
in __filemap_remove_folio -> page_cache_delete().



  reply	other threads:[~2023-12-31 13:07 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 [this message]
2024-01-01  1:55     ` Hillf Danton
2024-01-01  9:07       ` Matthew Wilcox
2024-01-01 11:33         ` Hillf Danton
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=ZZFnd3tZZvg2eZun@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=hdanton@sina.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lists@sapience.com \
    /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