Re: [PATCH v2] btrfs: Add graceful handling of V0 extents

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 27, 2018 at 09:12:06AM -0400, Noah Massey wrote:
> On Tue, Jun 26, 2018 at 12:02 PM David Sterba <dsterba@xxxxxxx> 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@xxxxxxxx>
> >
> > > -             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

Right, due to !=. Thanks for catching it.

> > +               } 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 */
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux