提交 eeee0d6a 编写于 作者: D Darrick J. Wong

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: NDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: NDave Chinner <dchinner@redhat.com>
上级 a37f7b12
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册