Commit 858b44dc authored by Darrick J. Wong's avatar Darrick J. Wong

xfs: remove more ondisk directory corruption asserts

Continue our game of replacing ASSERTs for corrupt ondisk metadata with
EFSCORRUPTED returns.
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: default avatarBill O'Donnell <billodo@redhat.com>
parent 294fc7a4
......@@ -487,10 +487,8 @@ xfs_da3_split(
ASSERT(state->path.active == 0);
oldblk = &state->path.blk[0];
error = xfs_da3_root_split(state, oldblk, addblk);
if (error) {
addblk->bp = NULL;
return error; /* GROT: dir is inconsistent */
}
if (error)
goto out;
/*
* Update pointers to the node which used to be block 0 and just got
......@@ -505,7 +503,10 @@ xfs_da3_split(
*/
node = oldblk->bp->b_addr;
if (node->hdr.info.forw) {
ASSERT(be32_to_cpu(node->hdr.info.forw) == addblk->blkno);
if (be32_to_cpu(node->hdr.info.forw) != addblk->blkno) {
error = -EFSCORRUPTED;
goto out;
}
node = addblk->bp->b_addr;
node->hdr.info.back = cpu_to_be32(oldblk->blkno);
xfs_trans_log_buf(state->args->trans, addblk->bp,
......@@ -514,15 +515,19 @@ xfs_da3_split(
}
node = oldblk->bp->b_addr;
if (node->hdr.info.back) {
ASSERT(be32_to_cpu(node->hdr.info.back) == addblk->blkno);
if (be32_to_cpu(node->hdr.info.back) != addblk->blkno) {
error = -EFSCORRUPTED;
goto out;
}
node = addblk->bp->b_addr;
node->hdr.info.forw = cpu_to_be32(oldblk->blkno);
xfs_trans_log_buf(state->args->trans, addblk->bp,
XFS_DA_LOGRANGE(node, &node->hdr.info,
sizeof(node->hdr.info)));
}
out:
addblk->bp = NULL;
return 0;
return error;
}
/*
......
......@@ -741,7 +741,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;
/*
* Look up the hash value in the leaf entries.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment