From: Hillf Danton <hdanton@sina.com>
To: Genes Lists <lists@sapience.com>
Cc: Matthew Wilcox <willy@infradead.org>,
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 09:28:46 +0800 [thread overview]
Message-ID: <20231231012846.2355-1-hdanton@sina.com> (raw)
In-Reply-To: <8bb29431064fc1f70a42edef75a8788dd4a0eecc.camel@sapience.com>
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.
--- x/mm/page-writeback.c
+++ y/mm/page-writeback.c
@@ -2661,12 +2661,19 @@ void __folio_mark_dirty(struct folio *fo
{
unsigned long flags;
+again:
xa_lock_irqsave(&mapping->i_pages, flags);
- if (folio->mapping) { /* Race with truncate? */
+ if (folio->mapping && mapping == folio->mapping) {
WARN_ON_ONCE(warn && !folio_test_uptodate(folio));
folio_account_dirtied(folio, mapping);
__xa_set_mark(&mapping->i_pages, folio_index(folio),
PAGECACHE_TAG_DIRTY);
+ } else if (folio->mapping) { /* Race with truncate? */
+ struct address_space *tmp = folio->mapping;
+
+ xa_unlock_irqrestore(&mapping->i_pages, flags);
+ mapping = tmp;
+ goto again;
}
xa_unlock_irqrestore(&mapping->i_pages, flags);
}
--
next prev parent reply other threads:[~2023-12-31 1:29 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 [this message]
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
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=20231231012846.2355-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