From: David Sterba <dsterba@suse.cz>
To: Josef Bacik <josef@toxicpanda.com>
Cc: dsterba@suse.cz, linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH 1/2] btrfs: free fs roots on failed mount
Date: Mon, 27 Jul 2020 17:17:17 +0200 [thread overview]
Message-ID: <20200727151717.GO3703@twin.jikos.cz> (raw)
In-Reply-To: <b8a83f87-752d-98a5-3674-fde808b77af4@toxicpanda.com>
On Mon, Jul 27, 2020 at 10:33:32AM -0400, Josef Bacik wrote:
> >> @@ -3441,6 +3440,7 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
> >> btrfs_put_block_group_cache(fs_info);
> >>
> >> fail_tree_roots:
> >> + btrfs_free_fs_roots(fs_info);
> >> free_root_pointers(fs_info, true);
> >
> > The data reloc tree is freed inside free_root_pointers, that it's also
> > in the radix tree is for convenience so I'd rather fix it inside
> > free_root_pointers and not reorder btrfs_free_fs_roots.
>
> We can't do that, because free_root_pointers() is called to drop the extent
> buffers when we're looping through the backup roots. btrfs_free_fs_roots() is
> the correct thing to do here, it goes through anything that ended up in the
> radix tree. Thanks,
I see, free_root_pointers is used elsewhere. I'm concerned about the
reordeing because there are several functions that are now called after
the roots are freed.
(before) btrfs_free_fs_roots(fs_info);
kthread_stop(fs_info->cleaner_kthread);
filemap_write_and_wait(fs_info->btree_inode->i_mapping);
btrfs_sysfs_remove_mounted(fs_info);
btrfs_sysfs_remove_fsid(fs_info->fs_devices);
btrfs_put_block_group_cache(fs_info);
(after) btrfs_free_fs_roots(fs_info);
If something called by btrfs_free_fs_roots depends on structures
removed/cleaned by the other functions, eg. btrfs_put_block_group_cache
ti could be a problem.
I haven't spotted anything so far, the functions are called after
failure still during mount, this is easier than shutdown sequence after
a full mount.
next prev parent reply other threads:[~2020-07-27 15:17 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-22 16:07 [PATCH 1/2] btrfs: free fs roots on failed mount Josef Bacik
2020-07-22 16:07 ` [PATCH 2/2] btrfs: fix root leak printk to use %lld instead of %llu Josef Bacik
2020-07-23 14:20 ` David Sterba
2020-07-24 0:40 ` Qu Wenruo
2020-07-27 14:03 ` David Sterba
2020-07-27 14:07 ` David Sterba
2020-07-27 23:47 ` Qu Wenruo
2020-07-28 15:09 ` David Sterba
2020-07-27 14:19 ` [PATCH 1/2] btrfs: free fs roots on failed mount David Sterba
2020-07-27 14:33 ` Josef Bacik
2020-07-27 15:17 ` David Sterba [this message]
2020-07-27 15:37 ` Josef Bacik
-- strict thread matches above, loose matches on Subject: below --
2020-08-20 20:00 [PATCH 0/2][v2] Some leaked root fixes Josef Bacik
2020-08-20 20:00 ` [PATCH 1/2] btrfs: free fs roots on failed mount Josef Bacik
2020-08-21 7:31 ` Nikolay Borisov
2020-08-21 13:59 ` Josef Bacik
2020-08-21 14:07 ` Nikolay Borisov
2020-09-03 18:29 [PATCH 0/2][v3] Some leaked root fixes Josef Bacik
2020-09-03 18:29 ` [PATCH 1/2] btrfs: free fs roots on failed mount Josef Bacik
2020-09-07 12:50 ` David Sterba
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=20200727151717.GO3703@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=josef@toxicpanda.com \
--cc=kernel-team@fb.com \
--cc=linux-btrfs@vger.kernel.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