From: Qu Wenruo <wqu@suse.com>
To: Christian Brauner <brauner@kernel.org>,
Qu Wenruo <quwenruo.btrfs@gmx.com>
Cc: linux-fsdevel@vger.kernel.org,
linux-btrfs <linux-btrfs@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: mnt_list corruption triggered during btrfs/326
Date: Sun, 5 Jan 2025 08:56:02 +1030 [thread overview]
Message-ID: <6f5f97bc-6333-4d07-9684-1f9bab9bd571@suse.com> (raw)
In-Reply-To: <20250104-gockel-zeitdokument-59fe0ff5b509@brauner>
在 2025/1/4 21:56, Christian Brauner 写道:
> On Wed, Jan 01, 2025 at 07:05:10AM +1030, Qu Wenruo wrote:
>>
>>
>> 在 2024/12/30 19:59, Qu Wenruo 写道:
>>> Hi,
>>>
>>> Although I know it's triggered from btrfs, but the mnt_list handling is
>>> out of btrfs' control, so I'm here asking for some help.
>
> Thanks for the report.
>
>>>
>>> [BUG]
>>> With CONFIG_DEBUG_LIST and CONFIG_BUG_ON_DATA_CORRUPTION, and an
>>> upstream 6.13-rc kernel, which has commit 951a3f59d268 ("btrfs: fix
>>> mount failure due to remount races"), I can hit the following crash,
>>> with varied frequency (from 1/4 to hundreds runs no crash):
>>
>> There is also another WARNING triggered, without btrfs callback involved
>> at all:
>>
>> [ 192.688671] ------------[ cut here ]------------
>> [ 192.690016] WARNING: CPU: 3 PID: 59747 at fs/mount.h:150
>
> This would indicate that move_from_ns() was called on a mount that isn't
> attached to a mount namespace (anymore or never has).
>
> Here's it's particularly peculiar because it looks like the warning is
> caused by calling move_from_ns() when moving a mount from an anonymous
> mount namespace in attach_recursive_mnt().
>
> Can you please try and reproduce this with
> commit 211364bef4301838b2e1 ("fs: kill MNT_ONRB")
> from the vfs-6.14.mount branch in
> https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git ?
>
After the initial 1000 runs (with 951a3f59d268 ("btrfs: fix mount
failure due to remount races") cherry picked, or it won't pass that test
case), there is no crash nor warning so far.
It's already the best run so far, but I'll keep it running for another
day or so just to be extra safe.
So I guess the offending commit is 2eea9ce4310d ("mounts: keep list of
mounts in an rbtree")?
Putting a list and rb_tree into a union indeed seems a little dangerous,
sorry I didn't notice that earlier, but my vmcore indeed show a
seemingly valid mnt_node (color = 1, both left/right are NULL).
Thanks a lot for the fix, and it's really a huge relief that it's not
something inside btrfs causing the bug.
Thanks,
Qu
[...]
>>>
>>> The only caller doesn't hold @mount_lock is iterate_mounts() but that's
>>> only called from audit, and I'm not sure if audit is even involved in
>>> this case.
>
> This is fine as audit creates a private copy of the mount tree it is
> interested in. The mount tree is not visible to other callers anymore.
>
>>>
>>> So I ran out of ideas why this mnt_list can even happen.
>>>
>>> Even if it's some btrfs' abuse, all mnt_list users are properly
>>> protected thus it should not lead to such list corruption.
>>>
>>> Any advice would be appreciated.
>>>
>>> Thanks,
>>> Qu
>>>
>>
>
next prev parent reply other threads:[~2025-01-04 22:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-30 9:29 Qu Wenruo
2024-12-31 20:35 ` Qu Wenruo
2025-01-04 11:26 ` Christian Brauner
2025-01-04 22:26 ` Qu Wenruo [this message]
2025-01-06 21:50 ` Daniel Vacek
2025-01-06 22:00 ` Qu Wenruo
2025-01-07 15:04 ` Daniel Vacek
2025-01-06 21:35 ` Daniel Vacek
2025-01-07 15:00 ` Christian Brauner
2025-01-09 12:51 ` Christian Brauner
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=6f5f97bc-6333-4d07-9684-1f9bab9bd571@suse.com \
--to=wqu@suse.com \
--cc=brauner@kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=quwenruo.btrfs@gmx.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
all inboxes | Powered by JetHome®