public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Brian Foster <bfoster@redhat.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 1/6] xfs: remove more ondisk directory corruption asserts
Date: Fri, 5 Jul 2019 10:03:45 -0700	[thread overview]
Message-ID: <20190705170345.GH1404256@magnolia> (raw)
In-Reply-To: <20190705144904.GC37448@bfoster>

On Fri, Jul 05, 2019 at 10:49:05AM -0400, Brian Foster wrote:
> On Wed, Jun 26, 2019 at 01:46:40PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> > 
> > Continue our game of replacing ASSERTs for corrupt ondisk metadata with
> > EFSCORRUPTED returns.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  fs/xfs/libxfs/xfs_da_btree.c  |   19 ++++++++++++-------
> >  fs/xfs/libxfs/xfs_dir2_node.c |    3 ++-
> >  2 files changed, 14 insertions(+), 8 deletions(-)
> > 
> > 
> ...
> > diff --git a/fs/xfs/libxfs/xfs_dir2_node.c b/fs/xfs/libxfs/xfs_dir2_node.c
> > index 16731d2d684b..f7f3fb458019 100644
> > --- a/fs/xfs/libxfs/xfs_dir2_node.c
> > +++ b/fs/xfs/libxfs/xfs_dir2_node.c
> > @@ -743,7 +743,8 @@ xfs_dir2_leafn_lookup_for_entry(
> >  	ents = dp->d_ops->leaf_ents_p(leaf);
> >  
> >  	xfs_dir3_leaf_check(dp, bp);
> > -	ASSERT(leafhdr.count > 0);
> > +	if (leafhdr.count <= 0)
> > +		return -EFSCORRUPTED;
> 
> This error return bubbles up to xfs_dir2_leafn_lookup_int() and
> xfs_da3_node_lookup_int(). The latter has a direct return value as well
> as a *result return parameter, which unconditionally carries the return
> value from xfs_dir2_leafn_lookup_int(). xfs_da3_node_lookup_int() has
> multiple callers, but a quick look at one (xfs_attr_node_addname())
> suggests we might not handle corruption errors properly via the *result
> parameter. Perhaps we also need to fix up xfs_da3_node_lookup_int() to
> return particular errors directly?

It would be a good idea to clean up the whole return value/*retval mess
in that function (and xfs_da3_path_shift where *retval came from) but
that quickly turned into a bigger cleanup of magic values and dual
returns, particularly since the dabtree shrinking code turns the
_path_shift *retval into yet another series of magic int numbers...

...so in the meantime this at least fixes the asserts I see when running
fuzz testing.  I'll look at the broader cleanup for 5.4.

--D

> 
> Brian
> 
> >  
> >  	/*
> >  	 * Look up the hash value in the leaf entries.
> > 

  reply	other threads:[~2019-07-05 17:04 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-26 20:46 [PATCH v2 0/6] xfs: scrub-related fixes Darrick J. Wong
2019-06-26 20:46 ` [PATCH 1/6] xfs: remove more ondisk directory corruption asserts Darrick J. Wong
2019-07-05 14:49   ` Brian Foster
2019-07-05 17:03     ` Darrick J. Wong [this message]
2019-07-05 17:27       ` Brian Foster
2019-06-26 20:46 ` [PATCH 2/6] xfs: attribute scrub should use seen_enough to pass error values Darrick J. Wong
2019-07-05 14:49   ` Brian Foster
2019-07-05 16:46     ` Darrick J. Wong
2019-06-26 20:46 ` [PATCH 3/6] xfs: refactor extended attribute buffer pointer functions Darrick J. Wong
2019-07-05 14:52   ` Brian Foster
2019-06-26 20:46 ` [PATCH 4/6] xfs: refactor attr scrub memory allocation function Darrick J. Wong
2019-07-05 14:52   ` Brian Foster
2019-06-26 20:47 ` [PATCH 5/6] xfs: only allocate memory for scrubbing attributes when we need it Darrick J. Wong
2019-07-05 14:52   ` Brian Foster
2019-07-05 16:49     ` Darrick J. Wong
2019-06-26 20:47 ` [PATCH 6/6] xfs: online scrub needn't bother zeroing its temporary buffer Darrick J. Wong
2019-07-05 14:52   ` Brian Foster
2019-07-05 16:35     ` Darrick J. Wong
2019-07-05 17:26       ` Brian Foster
2019-07-05 17:57         ` Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190705170345.GH1404256@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=bfoster@redhat.com \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox