From: Anand Jain <anand.jain@oracle.com>
To: Josef Bacik <josef@toxicpanda.com>,
linux-btrfs@vger.kernel.org, kernel-team@fb.com
Cc: Neal Gompa <ngompa13@gmail.com>
Subject: Re: [PATCH 3/3] btrfs: don't init dev replace for bad dev root
Date: Fri, 12 Mar 2021 14:50:14 +0800 [thread overview]
Message-ID: <abefa34f-8f15-055b-ab38-8b2cf3952472@oracle.com> (raw)
In-Reply-To: <b6183586bd5d9dd6f26ff4aaf3bab0a6629c6018.1615479658.git.josef@toxicpanda.com>
On 12/3/21 12:23 am, Josef Bacik wrote:
> While helping Neal fix his broken file system I added a debug patch to
> catch if we were calling btrfs_search_slot with a NULL root, and this
> stack trace popped
>
> we tried to search with a NULL root
> CPU: 0 PID: 1760 Comm: mount Not tainted 5.11.0-155.nealbtrfstest.1.fc34.x86_64 #1
> Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 07/22/2020
> Call Trace:
> dump_stack+0x6b/0x83
> btrfs_search_slot.cold+0x11/0x1b
> ? btrfs_init_dev_replace+0x36/0x450
> btrfs_init_dev_replace+0x71/0x450
> open_ctree+0x1054/0x1610
> btrfs_mount_root.cold+0x13/0xfa
> legacy_get_tree+0x27/0x40
> vfs_get_tree+0x25/0xb0
> vfs_kern_mount.part.0+0x71/0xb0
> btrfs_mount+0x131/0x3d0
> ? legacy_get_tree+0x27/0x40
> ? btrfs_show_options+0x640/0x640
> legacy_get_tree+0x27/0x40
> vfs_get_tree+0x25/0xb0
> path_mount+0x441/0xa80
> __x64_sys_mount+0xf4/0x130
> do_syscall_64+0x33/0x40
> entry_SYSCALL_64_after_hwframe+0x44/0xa9
> RIP: 0033:0x7f644730352e
>
> Fix this by not starting the device replace stuff if we do not have a
> NULL dev root.
>
> Reported-by: Neal Gompa <ngompa13@gmail.com>
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
> ---
> fs/btrfs/dev-replace.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
> index 3a9c1e046ebe..d05f73530af7 100644
> --- a/fs/btrfs/dev-replace.c
> +++ b/fs/btrfs/dev-replace.c
> @@ -81,6 +81,9 @@ int btrfs_init_dev_replace(struct btrfs_fs_info *fs_info)
> struct btrfs_dev_replace_item *ptr;
> u64 src_devid;
>
> + if (!dev_root)
> + return 0;
> +
If we have a replace device target. fs_info->dev_replace->is_valid is
0, and btrfs_dev_replace_is_ongoing() is false. And num_device count
at various places does not include replace target device. And also
this happens only in RO mount.
Reviewed-by: Anand Jain <anand.jain@oracle.com>
> path = btrfs_alloc_path();
> if (!path) {
> ret = -ENOMEM;
>
next prev parent reply other threads:[~2021-03-12 6:51 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-11 16:23 [PATCH 0/3] Handle bad dev_root properly with rescue=all Josef Bacik
2021-03-11 16:23 ` [PATCH 1/3] btrfs: init devices always Josef Bacik
2021-03-12 5:52 ` Anand Jain
2021-03-12 5:57 ` Anand Jain
2021-03-17 11:03 ` David Sterba
2021-03-12 5:58 ` Anand Jain
2021-03-11 16:23 ` [PATCH 2/3] btrfs: do not init dev stats if we have no dev_root Josef Bacik
2021-03-12 5:59 ` Anand Jain
2021-03-11 16:23 ` [PATCH 3/3] btrfs: don't init dev replace for bad dev root Josef Bacik
2021-03-12 6:50 ` Anand Jain [this message]
2021-03-11 19:18 ` [PATCH 0/3] Handle bad dev_root properly with rescue=all Neal Gompa
2021-03-17 12:27 ` David Sterba
2021-03-17 15:30 ` Josef Bacik
2021-03-18 15:43 ` David Sterba
2021-03-18 20:45 ` Josef Bacik
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=abefa34f-8f15-055b-ab38-8b2cf3952472@oracle.com \
--to=anand.jain@oracle.com \
--cc=josef@toxicpanda.com \
--cc=kernel-team@fb.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=ngompa13@gmail.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