diff mbox series

[1/2] xfs_repair: complain about ag header crc errors

Message ID 159311835284.1065505.8957820680195453723.stgit@magnolia (mailing list archive)
State Superseded
Headers show
Series xfs_repair: more fixes | expand

Commit Message

Darrick J. Wong June 25, 2020, 8:52 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

Repair doesn't complain about crc errors in the AG headers, and it
should.  Otherwise give the admin the wrong impression about the
state of the filesystem after a nomodify check.

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

Comments

Brian Foster June 29, 2020, 12:20 p.m. UTC | #1
On Thu, Jun 25, 2020 at 01:52:32PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Repair doesn't complain about crc errors in the AG headers, and it
> should.  Otherwise give the admin the wrong impression about the
> state of the filesystem after a nomodify check.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  repair/scan.c |    6 ++++++
>  1 file changed, 6 insertions(+)
> 
> 
> diff --git a/repair/scan.c b/repair/scan.c
> index 505cfc53..42b299f7 100644
> --- a/repair/scan.c
> +++ b/repair/scan.c
> @@ -2441,6 +2441,8 @@ scan_ag(
>  		objname = _("root superblock");
>  		goto out_free_sb;
>  	}
> +	if (sbbuf->b_error == -EFSBADCRC)
> +		do_warn(_("superblock has bad CRC for ag %d\n"), agno);

So salvage_buffer() reads the buf and passes along the verifier. If the
verifier fails, we ignore the error and return 0 because of
LIBXFS_READBUF_SALVAGE, but leave it set in bp->b_error so it should be
accessible here. Looks Ok:

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

>  	libxfs_sb_from_disk(sb, sbbuf->b_addr);
>  
>  	error = salvage_buffer(mp->m_dev,
> @@ -2450,6 +2452,8 @@ scan_ag(
>  		objname = _("agf block");
>  		goto out_free_sbbuf;
>  	}
> +	if (agfbuf->b_error == -EFSBADCRC)
> +		do_warn(_("agf has bad CRC for ag %d\n"), agno);
>  	agf = agfbuf->b_addr;
>  
>  	error = salvage_buffer(mp->m_dev,
> @@ -2459,6 +2463,8 @@ scan_ag(
>  		objname = _("agi block");
>  		goto out_free_agfbuf;
>  	}
> +	if (agibuf->b_error == -EFSBADCRC)
> +		do_warn(_("agi has bad CRC for ag %d\n"), agno);
>  	agi = agibuf->b_addr;
>  
>  	/* fix up bad ag headers */
>
Darrick J. Wong June 29, 2020, 11:11 p.m. UTC | #2
On Mon, Jun 29, 2020 at 08:20:31AM -0400, Brian Foster wrote:
> On Thu, Jun 25, 2020 at 01:52:32PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> > 
> > Repair doesn't complain about crc errors in the AG headers, and it
> > should.  Otherwise give the admin the wrong impression about the

"Otherwise, this gives the admin the wrong impression..."

I'll fix this before the next repost, though if the maintainer chooses
to pull it in before then, please make this minor correction.

> > state of the filesystem after a nomodify check.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  repair/scan.c |    6 ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > 
> > diff --git a/repair/scan.c b/repair/scan.c
> > index 505cfc53..42b299f7 100644
> > --- a/repair/scan.c
> > +++ b/repair/scan.c
> > @@ -2441,6 +2441,8 @@ scan_ag(
> >  		objname = _("root superblock");
> >  		goto out_free_sb;
> >  	}
> > +	if (sbbuf->b_error == -EFSBADCRC)
> > +		do_warn(_("superblock has bad CRC for ag %d\n"), agno);
> 
> So salvage_buffer() reads the buf and passes along the verifier. If the
> verifier fails, we ignore the error and return 0 because of
> LIBXFS_READBUF_SALVAGE, but leave it set in bp->b_error so it should be
> accessible here. Looks Ok:

Yep.

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

Thanks for the review!

--D

> 
> >  	libxfs_sb_from_disk(sb, sbbuf->b_addr);
> >  
> >  	error = salvage_buffer(mp->m_dev,
> > @@ -2450,6 +2452,8 @@ scan_ag(
> >  		objname = _("agf block");
> >  		goto out_free_sbbuf;
> >  	}
> > +	if (agfbuf->b_error == -EFSBADCRC)
> > +		do_warn(_("agf has bad CRC for ag %d\n"), agno);
> >  	agf = agfbuf->b_addr;
> >  
> >  	error = salvage_buffer(mp->m_dev,
> > @@ -2459,6 +2463,8 @@ scan_ag(
> >  		objname = _("agi block");
> >  		goto out_free_agfbuf;
> >  	}
> > +	if (agibuf->b_error == -EFSBADCRC)
> > +		do_warn(_("agi has bad CRC for ag %d\n"), agno);
> >  	agi = agibuf->b_addr;
> >  
> >  	/* fix up bad ag headers */
> > 
>
diff mbox series

Patch

diff --git a/repair/scan.c b/repair/scan.c
index 505cfc53..42b299f7 100644
--- a/repair/scan.c
+++ b/repair/scan.c
@@ -2441,6 +2441,8 @@  scan_ag(
 		objname = _("root superblock");
 		goto out_free_sb;
 	}
+	if (sbbuf->b_error == -EFSBADCRC)
+		do_warn(_("superblock has bad CRC for ag %d\n"), agno);
 	libxfs_sb_from_disk(sb, sbbuf->b_addr);
 
 	error = salvage_buffer(mp->m_dev,
@@ -2450,6 +2452,8 @@  scan_ag(
 		objname = _("agf block");
 		goto out_free_sbbuf;
 	}
+	if (agfbuf->b_error == -EFSBADCRC)
+		do_warn(_("agf has bad CRC for ag %d\n"), agno);
 	agf = agfbuf->b_addr;
 
 	error = salvage_buffer(mp->m_dev,
@@ -2459,6 +2463,8 @@  scan_ag(
 		objname = _("agi block");
 		goto out_free_agfbuf;
 	}
+	if (agibuf->b_error == -EFSBADCRC)
+		do_warn(_("agi has bad CRC for ag %d\n"), agno);
 	agi = agibuf->b_addr;
 
 	/* fix up bad ag headers */