public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 4/3] xfs: verify root inode more thoroughly
Date: Tue, 5 Jun 2018 15:30:13 +1000	[thread overview]
Message-ID: <20180605053013.GF10363@dastard> (raw)
In-Reply-To: <20180605040657.GD9437@magnolia>

On Mon, Jun 04, 2018 at 09:06:57PM -0700, Darrick J. Wong wrote:
> On Tue, Jun 05, 2018 at 12:57:04PM +1000, Dave Chinner wrote:
> > 
> > From: Dave Chinner <dchinner@redhat.com>
> > 
> > When looking up the root inode at mount time, we don't actually do
> > any verification to check that the inode is allocated and accounted
> > for correctly in the INOBT. Make the checks on the root inode more
> > robust by making it an untrusted lookup. This forces the inode
> > lookup to use the inode btree to verify the inode is allocated
> > and mapped correctly to disk. This will also have the effect of
> > catching a significant number of AGI/INOBT related corruptions in
> > AG 0 at mount time.
> > 
> > Signed-off-by: Dave Chinner <dchinner@redhat.com>
> > 
> > ---
> >  fs/xfs/xfs_mount.c | 7 +++++--
> >  1 file changed, 5 insertions(+), 2 deletions(-)
> > 
> > diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
> > index 189fa7b615d3..a3378252baa1 100644
> > --- a/fs/xfs/xfs_mount.c
> > +++ b/fs/xfs/xfs_mount.c
> > @@ -862,9 +862,12 @@ xfs_mountfs(
> >  	 * Get and sanity-check the root inode.
> >  	 * Save the pointer to it in the mount structure.
> >  	 */
> > -	error = xfs_iget(mp, NULL, sbp->sb_rootino, 0, XFS_ILOCK_EXCL, &rip);
> > +	error = xfs_iget(mp, NULL, sbp->sb_rootino, XFS_IGET_UNTRUSTED,
> 
> One little quirk I've noticed with xfs_iget is that a corrupt inode
> buffer's -EFSCORRUPTED gets turned into -EINVAL on the way out of iget.

That's in xfs_imap_to_bp(), right?

And the only place we care about this is xfs_nfs_get_inode() so that
we return ESTALE rather than EFSCORRUPTED, yes?

Ok, so let's fix that.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2018-06-05  5:30 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-05  2:43 [PATCH 0/3] xfs: more verifications! Dave Chinner
2018-06-05  2:43 ` [PATCH 1/3] xfs: catch bad stripe alignment configurations Dave Chinner
2018-06-05  3:44   ` Darrick J. Wong
2018-06-05  2:43 ` [PATCH 2/3] xfs: verify extent size hint is valid in inode verifier Dave Chinner
2018-06-05  4:08   ` Darrick J. Wong
2018-06-05  4:24     ` Dave Chinner
2018-06-05  4:28       ` Darrick J. Wong
2018-06-05  4:47         ` Dave Chinner
2018-06-05  2:43 ` [PATCH 3/3] xfs: validate btree records on retreival Dave Chinner
2018-06-05  4:02   ` Darrick J. Wong
2018-06-05  4:39     ` Dave Chinner
2018-06-05  5:08       ` Dave Chinner
2018-06-05  2:57 ` [PATCH 4/3] xfs: verify root inode more thoroughly Dave Chinner
2018-06-05  4:06   ` Darrick J. Wong
2018-06-05  5:30     ` Dave Chinner [this message]
2018-06-05  3:38 ` [PATCH 0/3] xfs: more verifications! Darrick J. Wong
2018-06-05  4:44   ` Dave Chinner

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=20180605053013.GF10363@dastard \
    --to=david@fromorbit.com \
    --cc=darrick.wong@oracle.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