linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Noah Massey <noah.massey@gmail.com>
To: David Sterba <dsterba@suse.cz>,
	Nikolay Borisov <nborisov@suse.com>,
	David Sterba <dsterba@suse.com>,
	linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH v2] btrfs: Add graceful handling of V0 extents
Date: Wed, 27 Jun 2018 09:12:06 -0400	[thread overview]
Message-ID: <CADfjVrgZAgXFLDV7KJ4tYby9EAEOOdBOxo5EHQRW4dsNGQMeZQ@mail.gmail.com> (raw)
In-Reply-To: <20180626141659.GJ27958@twin.jikos.cz>

On Tue, Jun 26, 2018 at 12:02 PM David Sterba <dsterba@suse.cz> wrote:
>
> On Tue, Jun 26, 2018 at 04:57:36PM +0300, Nikolay Borisov wrote:
> > Following the removal of the v0 handling code let's be courteous and
> > print an error message when such extents are handled. In the cases
> > where we have a transaction just abort it, otherwise just call
> > btrfs_handle_fs_error. Both cases result in the FS being re-mounted RO.
> >
> > Signed-off-by: Nikolay Borisov <nborisov@suse.com>
>
> > -             ASSERT(key.type != BTRFS_EXTENT_REF_V0_KEY);
> > -             if (key.type == BTRFS_SHARED_BLOCK_REF_KEY) {
> > +             if (key.type == BTRFS_EXTENT_REF_V0_KEY) {
> > +                     err = -EINVAL;
> > +                     btrfs_print_v0_err(rc->extent_root->fs_info);
> > +                     btrfs_handle_fs_error(rc->extent_root->fs_info, err,
> > +                                           NULL);
> > +                     goto out;
> > +             } else if (key.type == BTRFS_SHARED_BLOCK_REF_KEY) {
>
> The v0 check should be made last as it's not expected to happen. I'm
> commiting with this diff
>
> --- a/fs/btrfs/relocation.c
> +++ b/fs/btrfs/relocation.c
> @@ -787,13 +787,7 @@ struct backref_node *build_backref_tree(struct reloc_control *rc,
>                         goto next;
>                 }
>
> -               if (key.type == BTRFS_EXTENT_REF_V0_KEY) {
> -                       err = -EINVAL;
> -                       btrfs_print_v0_err(rc->extent_root->fs_info);
> -                       btrfs_handle_fs_error(rc->extent_root->fs_info, err,
> -                                             NULL);
> -                       goto out;
> -               } else if (key.type == BTRFS_SHARED_BLOCK_REF_KEY) {
> +               if (key.type == BTRFS_SHARED_BLOCK_REF_KEY) {
>                         if (key.objectid == key.offset) {
>                                 /*
>                                  * only root blocks of reloc trees use
> @@ -838,6 +832,12 @@ struct backref_node *build_backref_tree(struct reloc_control *rc,
>                         goto next;
>                 } else if (key.type != BTRFS_TREE_BLOCK_REF_KEY) {
>                         goto next;

The V0 check needs to be before this one

> +               } else if (key.type == BTRFS_EXTENT_REF_V0_KEY) {
> +                       err = -EINVAL;
> +                       btrfs_print_v0_err(rc->extent_root->fs_info);
> +                       btrfs_handle_fs_error(rc->extent_root->fs_info, err,
> +                                             NULL);
> +                       goto out;
>                 }
>
>                 /* key.type == BTRFS_TREE_BLOCK_REF_KEY */
> @@ -3734,11 +3734,7 @@ int add_data_references(struct reloc_control *rc,
>                 if (key.objectid != extent_key->objectid)
>                         break;
>
> -               if (key.type == BTRFS_EXTENT_REF_V0_KEY) {
> -                       btrfs_print_v0_err(eb->fs_info);
> -                       btrfs_handle_fs_error(eb->fs_info, -EINVAL, NULL);
> -                       ret = -EINVAL;
> -               } else if (key.type == BTRFS_SHARED_DATA_REF_KEY) {
> +               if (key.type == BTRFS_SHARED_DATA_REF_KEY) {
>                         ret = __add_tree_block(rc, key.offset, blocksize,
>                                                blocks);
>                 } else if (key.type == BTRFS_EXTENT_DATA_REF_KEY) {
> @@ -3746,6 +3742,10 @@ int add_data_references(struct reloc_control *rc,
>                                               struct btrfs_extent_data_ref);
>                         ret = find_data_references(rc, extent_key,
>                                                    eb, dref, blocks);
> +               } else if (key.type == BTRFS_EXTENT_REF_V0_KEY) {
> +                       btrfs_print_v0_err(eb->fs_info);
> +                       btrfs_handle_fs_error(eb->fs_info, -EINVAL, NULL);
> +                       ret = -EINVAL;
>                 } else {
>                         ret = 0;
>                 }
> --
> 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

  reply	other threads:[~2018-06-27 13:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-25  8:24 [PATCH 0/2] Remove v0 extent support Nikolay Borisov
2018-06-25  8:24 ` [PATCH 1/2] btrfs: Remove V0 " Nikolay Borisov
2018-06-25  8:24 ` [PATCH 2/2] btrfs: Add graceful handling of V0 extents Nikolay Borisov
2018-06-25 15:21   ` David Sterba
2018-06-26 13:57     ` [PATCH v2] " Nikolay Borisov
2018-06-26 14:17       ` David Sterba
2018-06-27 13:12         ` Noah Massey [this message]
2018-06-27 13:21           ` David Sterba
2018-06-26 14:24       ` [PATCH] btrfs: annotate unlikely branches after V0 extent type removal David Sterba
2018-06-26 14:31         ` Nikolay Borisov
2018-06-26 14:43           ` David Sterba
2018-06-26 16:05       ` [PATCH v2] btrfs: Add graceful handling of V0 extents kbuild test robot
2018-06-26 17:12         ` David Sterba
2018-06-26 17:44       ` kbuild test robot

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=CADfjVrgZAgXFLDV7KJ4tYby9EAEOOdBOxo5EHQRW4dsNGQMeZQ@mail.gmail.com \
    --to=noah.massey@gmail.com \
    --cc=dsterba@suse.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@suse.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;
as well as URLs for NNTP newsgroup(s).