diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2018-06-04 01:10:14 +0200 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2018-06-04 23:45:30 +0200 |
commit | eeee0d6a9bc93eaa211918c203fde263d44fa20e (patch) | |
tree | dc57a131d7b8e04da8157835efdbbfd0b19035c1 /fs/xfs | |
parent | xfs: xfs_alloc_get_rec should return EFSCORRUPTED for obvious bnobt corruption (diff) | |
download | linux-eeee0d6a9bc93eaa211918c203fde263d44fa20e.tar.xz linux-eeee0d6a9bc93eaa211918c203fde263d44fa20e.zip |
xfs: btree lookup shouldn't ASSERT on empty btree nodes
If a btree lookup encounters an empty btree node or an empty btree leaf
on a multi-level btree, that's evidence of a corrupt on-disk btree.
Therefore, we should return -EFSCORRUPTED to the upper levels, not an
ASSERT failure.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/libxfs/xfs_btree.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/xfs/libxfs/xfs_btree.c b/fs/xfs/libxfs/xfs_btree.c index c825c8182b30..3d59eb675693 100644 --- a/fs/xfs/libxfs/xfs_btree.c +++ b/fs/xfs/libxfs/xfs_btree.c @@ -1896,7 +1896,12 @@ xfs_btree_lookup( high = xfs_btree_get_numrecs(block); if (!high) { /* Block is empty, must be an empty leaf. */ - ASSERT(level == 0 && cur->bc_nlevels == 1); + if (level != 0 || cur->bc_nlevels != 1) { + XFS_CORRUPTION_ERROR(__func__, + XFS_ERRLEVEL_LOW, + cur->bc_mp, block); + return -EFSCORRUPTED; + } cur->bc_ptrs[0] = dir != XFS_LOOKUP_LE; *stat = 0; |