[05/12] xfs_repair: inject lost blocks back into the fs no matter the owner
diff mbox series

Message ID 159107204483.315004.966896847007086323.stgit@magnolia
State New
Headers show
Series
  • xfs_repair: use btree bulk loading
Related show

Commit Message

Darrick J. Wong June 2, 2020, 4:27 a.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

In repair phase 5, inject_lost_blocks takes the blocks that we allocated
but didn't use for constructing the new AG btrees and puts them back in
the filesystem by adding them to the free space.  The only btree that
can overestimate like that are the free space btrees, but in principle,
any of the btrees can do that.  If the others did, the rmap record owner
for those blocks won't necessarily be OWNER_AG, and if it isn't, repair
will fail.

Get rid of this logic bomb so that we can use it for /any/ block count
overestimation, and then we can use it to clean up after all
reconstruction of any btree type.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 repair/phase5.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Brian Foster June 17, 2020, 12:09 p.m. UTC | #1
On Mon, Jun 01, 2020 at 09:27:24PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> In repair phase 5, inject_lost_blocks takes the blocks that we allocated
> but didn't use for constructing the new AG btrees and puts them back in
> the filesystem by adding them to the free space.  The only btree that
> can overestimate like that are the free space btrees, but in principle,
> any of the btrees can do that.  If the others did, the rmap record owner
> for those blocks won't necessarily be OWNER_AG, and if it isn't, repair
> will fail.
> 
> Get rid of this logic bomb so that we can use it for /any/ block count
> overestimation, and then we can use it to clean up after all
> reconstruction of any btree type.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  repair/phase5.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> 
> diff --git a/repair/phase5.c b/repair/phase5.c
> index 44a6bda8..75c480fd 100644
> --- a/repair/phase5.c
> +++ b/repair/phase5.c
> @@ -2516,8 +2516,8 @@ inject_lost_blocks(
>  		if (error)
>  			goto out_cancel;
>  
> -		error = -libxfs_free_extent(tp, *fsb, 1, &XFS_RMAP_OINFO_AG,
> -					    XFS_AG_RESV_NONE);
> +		error = -libxfs_free_extent(tp, *fsb, 1,
> +				&XFS_RMAP_OINFO_ANY_OWNER, XFS_AG_RESV_NONE);
>  		if (error)
>  			goto out_cancel;
>  
>

Patch
diff mbox series

diff --git a/repair/phase5.c b/repair/phase5.c
index 44a6bda8..75c480fd 100644
--- a/repair/phase5.c
+++ b/repair/phase5.c
@@ -2516,8 +2516,8 @@  inject_lost_blocks(
 		if (error)
 			goto out_cancel;
 
-		error = -libxfs_free_extent(tp, *fsb, 1, &XFS_RMAP_OINFO_AG,
-					    XFS_AG_RESV_NONE);
+		error = -libxfs_free_extent(tp, *fsb, 1,
+				&XFS_RMAP_OINFO_ANY_OWNER, XFS_AG_RESV_NONE);
 		if (error)
 			goto out_cancel;