diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2017-10-17 21:37:39 -0700 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2017-10-26 15:38:24 -0700 |
commit | ab9d5dc59fe6157b8035c4b605166b868f678ee4 (patch) | |
tree | 4890f77ec080d9eeba75a27a82cad4acb1790b9b /fs/xfs/scrub/common.c | |
parent | 21fb4cb1981ef7e02f35a42b2a5ae619517dfe1b (diff) | |
download | linux-ab9d5dc59fe6157b8035c4b605166b868f678ee4.tar.gz |
xfs: scrub AGF and AGFL
Check the block references in the AGF and AGFL headers to make sure they make sense. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs/scrub/common.c')
-rw-r--r-- | fs/xfs/scrub/common.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/fs/xfs/scrub/common.c b/fs/xfs/scrub/common.c index cd6fada1b426..f0bb9ddc465c 100644 --- a/fs/xfs/scrub/common.c +++ b/fs/xfs/scrub/common.c @@ -246,6 +246,26 @@ xfs_scrub_set_incomplete( * cleaning everything up once we're through. */ +/* Decide if we want to return an AG header read failure. */ +static inline bool +want_ag_read_header_failure( + struct xfs_scrub_context *sc, + unsigned int type) +{ + /* Return all AG header read failures when scanning btrees. */ + if (sc->sm->sm_type != XFS_SCRUB_TYPE_AGF && + sc->sm->sm_type != XFS_SCRUB_TYPE_AGFL) + return true; + /* + * If we're scanning a given type of AG header, we only want to + * see read failures from that specific header. We'd like the + * other headers to cross-check them, but this isn't required. + */ + if (sc->sm->sm_type == type) + return true; + return false; +} + /* * Grab all the headers for an AG. * @@ -269,15 +289,11 @@ xfs_scrub_ag_read_headers( goto out; error = xfs_alloc_read_agf(mp, sc->tp, agno, 0, agf); - if (error) - goto out; - if (!*agf) { - error = -ENOMEM; + if (error && want_ag_read_header_failure(sc, XFS_SCRUB_TYPE_AGF)) goto out; - } error = xfs_alloc_read_agfl(mp, sc->tp, agno, agfl); - if (error) + if (error && want_ag_read_header_failure(sc, XFS_SCRUB_TYPE_AGFL)) goto out; out: |