* [PATCH] xfs_repair: don't abort on bad directory leaf crc during leaf check
@ 2015-03-18 23:22 Darrick J. Wong
2015-03-19 18:28 ` Brian Foster
0 siblings, 1 reply; 3+ messages in thread
From: Darrick J. Wong @ 2015-03-18 23:22 UTC (permalink / raw)
To: xfs
longform_dir2_check_leaf() checks a directory leaf block to help
decide if we need to rebuild the directory. If the verifier fails
with a CRC or corrupt structure error, rebuild the directory instead
of aborting.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
repair/phase6.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/repair/phase6.c b/repair/phase6.c
index 1728609..c09b394 100644
--- a/repair/phase6.c
+++ b/repair/phase6.c
@@ -1951,7 +1951,12 @@ longform_dir2_check_leaf(
da_bno = mp->m_dirleafblk;
error = dir_read_buf(ip, da_bno, -1, &bp, &xfs_dir3_leaf1_buf_ops,
&fixit);
- if (error) {
+ if (error == EFSBADCRC || error == EFSCORRUPTED || fixit) {
+ do_warn(
+ _("leaf block %u for directory inode %" PRIu64 " bad CRC\n"),
+ da_bno, ip->i_ino);
+ return 1;
+ } else if (error) {
do_error(
_("can't read block %u for directory inode %" PRIu64 ", error %d\n"),
da_bno, ip->i_ino, error);
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] xfs_repair: don't abort on bad directory leaf crc during leaf check
2015-03-18 23:22 [PATCH] xfs_repair: don't abort on bad directory leaf crc during leaf check Darrick J. Wong
@ 2015-03-19 18:28 ` Brian Foster
2015-03-19 20:03 ` Darrick J. Wong
0 siblings, 1 reply; 3+ messages in thread
From: Brian Foster @ 2015-03-19 18:28 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: xfs
On Wed, Mar 18, 2015 at 04:22:39PM -0700, Darrick J. Wong wrote:
> longform_dir2_check_leaf() checks a directory leaf block to help
> decide if we need to rebuild the directory. If the verifier fails
> with a CRC or corrupt structure error, rebuild the directory instead
> of aborting.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> repair/phase6.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/repair/phase6.c b/repair/phase6.c
> index 1728609..c09b394 100644
> --- a/repair/phase6.c
> +++ b/repair/phase6.c
> @@ -1951,7 +1951,12 @@ longform_dir2_check_leaf(
> da_bno = mp->m_dirleafblk;
> error = dir_read_buf(ip, da_bno, -1, &bp, &xfs_dir3_leaf1_buf_ops,
> &fixit);
> - if (error) {
> + if (error == EFSBADCRC || error == EFSCORRUPTED || fixit) {
> + do_warn(
> + _("leaf block %u for directory inode %" PRIu64 " bad CRC\n"),
> + da_bno, ip->i_ino);
> + return 1;
> + } else if (error) {
I don't think we'll ever see EFSBADCRC from this codepath (that appears
to be the purpose of 'fixit'). Looking at it further, it's self
documenting and robust against changes in the read codepath, so seems
pretty good to me:
Reviewed-by: Brian Foster <bfoster@redhat.com>
> do_error(
> _("can't read block %u for directory inode %" PRIu64 ", error %d\n"),
> da_bno, ip->i_ino, error);
>
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] xfs_repair: don't abort on bad directory leaf crc during leaf check
2015-03-19 18:28 ` Brian Foster
@ 2015-03-19 20:03 ` Darrick J. Wong
0 siblings, 0 replies; 3+ messages in thread
From: Darrick J. Wong @ 2015-03-19 20:03 UTC (permalink / raw)
To: Brian Foster; +Cc: xfs
On Thu, Mar 19, 2015 at 02:28:54PM -0400, Brian Foster wrote:
> On Wed, Mar 18, 2015 at 04:22:39PM -0700, Darrick J. Wong wrote:
> > longform_dir2_check_leaf() checks a directory leaf block to help
> > decide if we need to rebuild the directory. If the verifier fails
> > with a CRC or corrupt structure error, rebuild the directory instead
> > of aborting.
> >
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> > repair/phase6.c | 7 ++++++-
> > 1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/repair/phase6.c b/repair/phase6.c
> > index 1728609..c09b394 100644
> > --- a/repair/phase6.c
> > +++ b/repair/phase6.c
> > @@ -1951,7 +1951,12 @@ longform_dir2_check_leaf(
> > da_bno = mp->m_dirleafblk;
> > error = dir_read_buf(ip, da_bno, -1, &bp, &xfs_dir3_leaf1_buf_ops,
> > &fixit);
> > - if (error) {
> > + if (error == EFSBADCRC || error == EFSCORRUPTED || fixit) {
> > + do_warn(
> > + _("leaf block %u for directory inode %" PRIu64 " bad CRC\n"),
> > + da_bno, ip->i_ino);
> > + return 1;
> > + } else if (error) {
>
> I don't think we'll ever see EFSBADCRC from this codepath (that appears
> to be the purpose of 'fixit'). Looking at it further, it's self
> documenting and robust against changes in the read codepath, so seems
> pretty good to me:
We won't ever see it with the current paths; I threw in the EFSBADCRC to make
it clear that it's looking for "disk is ok but the contents may be junk" =>
rebuild structure.
Though now that I think about it, maybe that message should read:
"leaf block X for directory inode Y corrupt"
since at least in theory we could hit EFSCORRUPTED on a non-CRC FS.
--D
>
> Reviewed-by: Brian Foster <bfoster@redhat.com>
>
> > do_error(
> > _("can't read block %u for directory inode %" PRIu64 ", error %d\n"),
> > da_bno, ip->i_ino, error);
> >
> > _______________________________________________
> > xfs mailing list
> > xfs@oss.sgi.com
> > http://oss.sgi.com/mailman/listinfo/xfs
>
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-03-19 20:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-18 23:22 [PATCH] xfs_repair: don't abort on bad directory leaf crc during leaf check Darrick J. Wong
2015-03-19 18:28 ` Brian Foster
2015-03-19 20:03 ` Darrick J. Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox