From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: "Stéphane Lesimple" <stephane_btrfs2@lesimple.fr>
Subject: Re: [PATCH] btrfs: relocation: output warning message for leftover v1 space cache before aborting current data balance
Date: Wed, 30 Dec 2020 08:56:42 +0800 [thread overview]
Message-ID: <8ccfddee-3de4-f3ae-bb18-eadecf9621b4@suse.com> (raw)
In-Reply-To: <20201229003837.16074-1-wqu@suse.com>
On 2020/12/29 上午8:38, Qu Wenruo wrote:
> In delete_v1_space_cache(), if we find a leaf whose owner is tree root,
> and we can't grab the free space cache inode, then we return -ENOENT.
>
> However this would make the caller, add_data_references(), to consider
> this as a critical error, and abort current data balance.
>
> This happens for fs using free space cache v2, while still has v1 data
> left.
>
> For v2 free space cache, we no longer load v1 data, making btrfs_igrab()
> no longer work for root tree to grab v1 free space cache inodes.
>
> The proper fix for the problem is to delete v1 space cache completely
> during v2 convert.
>
> We can't just ignore the -ENOENT error, as for root tree we don't use
> reloc tree to replace its data references, but rely on COW.
> This means, we have no way to relocate the leftover v1 data, and block
> the relocation.
>
> This patch will just workaround it by outputting a warning message,
> showing the user how to manually solve it.
>
> Reported-by: Stéphane Lesimple <stephane_btrfs2@lesimple.fr>
> Signed-off-by: Qu Wenruo <wqu@suse.com>
Please discard this patch.
This didn't really solve the problem and may give the end user some
false impression.
Thanks,
Qu
> ---
> fs/btrfs/relocation.c | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
> index 19b7db8b2117..42746b59268d 100644
> --- a/fs/btrfs/relocation.c
> +++ b/fs/btrfs/relocation.c
> @@ -3027,6 +3027,25 @@ int add_data_references(struct reloc_control *rc,
> ret = delete_v1_space_cache(eb, rc->block_group,
> extent_key->objectid);
> free_extent_buffer(eb);
> + /*
> + * This happens when the fs is converted to use v2 space cache,
> + * but some v1 data is still left.
> + * In that case, we can't delete the v1 space cache data as we
> + * can't grab the free space cache inode anymore.
> + *
> + * And we can't ignore the error, as for root tree (where v1
> + * space cache is) we don't do reloc tree to replace the data
> + * to the new location, thus the old data will still be there,
> + * blocking the data chunk to be relocated.
> + *
> + * Here we just warn user about the problem, and provide a
> + * workaround.
> + * The proper fix is in the v2 convert mount, which should
> + * completely remove v1 data.
> + */
> + if (ret == -ENOENT)
> + btrfs_warn(fs_info,
> +"leftover v1 space cache found, please use btrfs-check --clear-space-cache v1 to clean it up");
> if (ret < 0)
> break;
> ret = __add_tree_block(rc, ref_node->val, blocksize, blocks);
>
prev parent reply other threads:[~2020-12-30 0:58 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-29 0:38 [PATCH] btrfs: relocation: output warning message for leftover v1 space cache before aborting current data balance Qu Wenruo
2020-12-29 9:27 ` Stéphane Lesimple
2020-12-29 10:29 ` Qu Wenruo
2020-12-29 11:08 ` Stéphane Lesimple
2020-12-29 11:30 ` Qu Wenruo
2020-12-29 12:30 ` Stéphane Lesimple
2020-12-29 12:41 ` Qu Wenruo
2020-12-29 12:51 ` Stéphane Lesimple
2020-12-29 13:06 ` Qu Wenruo
2020-12-29 13:17 ` Stéphane Lesimple
2020-12-30 5:49 ` Qu Wenruo
2020-12-30 8:39 ` Stéphane Lesimple
2020-12-30 0:56 ` Qu Wenruo [this message]
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=8ccfddee-3de4-f3ae-bb18-eadecf9621b4@suse.com \
--to=wqu@suse.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=stephane_btrfs2@lesimple.fr \
/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