xfs: always log corruption errors

Make sure we log something to dmesg whenever we return -EFSCORRUPTED up
the call stack.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
Darrick J. Wong 2019-11-02 09:40:53 -07:00
parent d243b89a61
commit a5155b870d
25 changed files with 179 additions and 45 deletions

View file

@ -373,8 +373,10 @@ xfs_dir2_leaf_to_node(
leaf = lbp->b_addr;
ltp = xfs_dir2_leaf_tail_p(args->geo, leaf);
if (be32_to_cpu(ltp->bestcount) >
(uint)dp->i_d.di_size / args->geo->blksize)
(uint)dp->i_d.di_size / args->geo->blksize) {
xfs_buf_corruption_error(lbp);
return -EFSCORRUPTED;
}
/*
* Copy freespace entries from the leaf block to the new block.
@ -445,8 +447,10 @@ xfs_dir2_leafn_add(
* Quick check just to make sure we are not going to index
* into other peoples memory
*/
if (index < 0)
if (index < 0) {
xfs_buf_corruption_error(bp);
return -EFSCORRUPTED;
}
/*
* If there are already the maximum number of leaf entries in
@ -739,8 +743,10 @@ xfs_dir2_leafn_lookup_for_entry(
ents = dp->d_ops->leaf_ents_p(leaf);
xfs_dir3_leaf_check(dp, bp);
if (leafhdr.count <= 0)
if (leafhdr.count <= 0) {
xfs_buf_corruption_error(bp);
return -EFSCORRUPTED;
}
/*
* Look up the hash value in the leaf entries.