xfs
[Top] [All Lists]

Re: [PATCH 04/11] xfs: ensure EFD trans aborts on log recovery extent fr

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: Re: [PATCH 04/11] xfs: ensure EFD trans aborts on log recovery extent free failure
From: Brian Foster <bfoster@xxxxxxxxxx>
Date: Mon, 10 Aug 2015 09:39:39 -0400
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <20150810123803.GC18933@xxxxxxxxxxxxxxx>
References: <1438883072-28706-1-git-send-email-bfoster@xxxxxxxxxx> <1438883072-28706-5-git-send-email-bfoster@xxxxxxxxxx> <20150809075311.GD3163@xxxxxxxxxxxxx> <20150810123803.GC18933@xxxxxxxxxxxxxxx>
User-agent: Mutt/1.5.23 (2014-03-12)
On Mon, Aug 10, 2015 at 08:38:04AM -0400, Brian Foster wrote:
> On Sun, Aug 09, 2015 at 12:53:11AM -0700, Christoph Hellwig wrote:
> > > +         /*
> > > +          * Log the EFD before error handling to ensure the EFD aborts
> > > +          * (and releases the EFI) on error.
> > > +          */
> > >           error = xfs_free_extent(tp, extp->ext_start, extp->ext_len);
> > >           xfs_trans_log_efd_extent(tp, efdp, extp->ext_start,
> > >                                    extp->ext_len);
> > 
> > Given that we now always need to log the extents in the EFD even on
> > error maybe it's time to move the call to xfs_free_extent into
> > xfs_trans_log_efd_extent and rename it to xfs_trans_free_extent?
> > 
> > Or even better convert xfs_bmap_finish to also walk the extents in the
> > EFI instead of xfs_bmap_free list and have a xfs_trans_free_extents helper
> > ala:
> > 
> 
> Good idea, I'll incorporate something like this.
> 
> Brian
> 

After taking a closer look at this, I think I'll go with the first idea
to push down xfs_free_extent(). The code below to iterate based on the
EFI, while a nice cleanup, complicates handling the free list on error.
E.g., we currently remove each bmap_free_item as it is successfully
processed so the resulting list is consistent with the items that were
not processed before the error.

It might not matter functionally at the moment since the caller probably
cancels the free list, but I consider that a landmine should we decide
to do something more with the unprocessed entries down the road.

Brian

> > int
> > xfs_trans_free_extents(
> >     struct xfs_trans        *tp,
> >     struct xfs_efi_log_item *efip)
> > {
> >     struct xfs_efd_log_item *efdp;
> >     int                     error = 0, i;
> > 
> >     efdp = xfs_trans_get_efd(tp, efip, efip->efi_format.efi_nextents);
> >     for (i = 0; i < efip->efi_format.efi_nextents; i++) {
> >             struct xfs_extent *extp = &efip->efi_format.efi_extents[i];
> > 
> >             error = xfs_free_extent(tp, extp->ext_start, extp->ext_len);
> >             xfs_trans_log_efd_extent(tp, efdp, extp->ext_start,
> >                                     extp->ext_len);
> > 
> >             if (error)
> >                     break;
> >     }
> > 
> >     return error;
> > }
> > 
> > _______________________________________________
> > xfs mailing list
> > xfs@xxxxxxxxxxx
> > http://oss.sgi.com/mailman/listinfo/xfs
> 
> _______________________________________________
> xfs mailing list
> xfs@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/xfs

<Prev in Thread] Current Thread [Next in Thread>