From: Anand Jain <Anand.Jain@oracle.com>
To: Eric Sandeen <sandeen@redhat.com>
Cc: linux-btrfs <linux-btrfs@vger.kernel.org>,
Alexander Block <ablock84@googlemail.com>
Subject: Re: [PATCH 1/2] btrfs-progs: set generation_v2 any time we write a new root
Date: Mon, 22 Apr 2013 17:30:14 +0800 [thread overview]
Message-ID: <51750326.9080905@oracle.com> (raw)
In-Reply-To: <5174C426.3030204@redhat.com>
yeah we should set the v2 parameter at all the place where
we call btrfs_set_root_generation. Sorry it slipped my mind.
Thanks for the fix.
Thanks, Anand
On 04/22/2013 01:01 PM, Eric Sandeen wrote:
> With this integration branch commit in place:
>
> 2bd1169 btrfs-progs: root_item generation_v2 is out of sync after btrfsck
>
> I started seeing generation mismatch messages from the kernel
> at mount time, after a fresh mkfs(!):
>
> btrfs: mismatching generation and generation_v2 found in root item...
>
> This is because the code which emits the warning does not do so if
> there is a mismatch but generation_v2 is 0; the above commit began
> setting generation_v2 to something non-zero, so the warning was emitted.
>
> The reason there is a mismatch at all is because mkfs.btrfs calls
> create_data_reloc_tree(), which copies a root, and then calls
> btrfs_set_root_generation(), bumping the original copied generation.
> But nothing updated generation_v2 to match on the way to disk.
>
> Fix this by updating generation_v2 in btrfs_insert_root(),
> as is done in the kernel.
>
> This is safe because it's a new root created by userspace, so
> the btrfs_root_item is guaranteed to be big enough to contain
> generation_v2.
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
>
> Another example of why we need to get userspace in sync with kernelspace...
>
> diff --git a/root-tree.c b/root-tree.c
> index 4454147..1823918 100644
> --- a/root-tree.c
> +++ b/root-tree.c
> @@ -105,6 +105,11 @@ int btrfs_insert_root(struct btrfs_trans_handle *trans, struct btrfs_root
> *item)
> {
> int ret;
> +
> + /*
> + * Make sure generation v1 and v2 match. See update_root for details.
> + */
> + btrfs_set_root_generation_v2(item, btrfs_root_generation(item));
> ret = btrfs_insert_item(trans, root, key, item, sizeof(*item));
> return ret;
> }
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
prev parent reply other threads:[~2013-04-22 9:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-22 5:01 [PATCH 1/2] btrfs-progs: set generation_v2 any time we write a new root Eric Sandeen
2013-04-22 5:13 ` [PATCH 2/2] btrfs-progs: enlarge root item if needed in btrfs_update_root Eric Sandeen
2013-04-22 5:16 ` [PATCH 2/2 V2] btrfs-progs: update generation_v2 " Eric Sandeen
2013-04-22 9:31 ` Anand Jain
2013-04-22 14:01 ` Eric Sandeen
2013-04-23 16:47 ` David Sterba
2013-04-22 9:30 ` Anand Jain [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=51750326.9080905@oracle.com \
--to=anand.jain@oracle.com \
--cc=ablock84@googlemail.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=sandeen@redhat.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