xfs: don't assert on corrupted unlinked inode list
Use the per-ag inode number verifiers to detect corrupt lists and error out, instead of using ASSERTs. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
This commit is contained in:
parent
2551a53053
commit
d2e7366542
|
@ -2090,10 +2090,15 @@ xfs_iunlink_remove(
|
||||||
* list this inode will go on.
|
* list this inode will go on.
|
||||||
*/
|
*/
|
||||||
agino = XFS_INO_TO_AGINO(mp, ip->i_ino);
|
agino = XFS_INO_TO_AGINO(mp, ip->i_ino);
|
||||||
ASSERT(agino != 0);
|
if (!xfs_verify_agino(mp, agno, agino))
|
||||||
|
return -EFSCORRUPTED;
|
||||||
bucket_index = agino % XFS_AGI_UNLINKED_BUCKETS;
|
bucket_index = agino % XFS_AGI_UNLINKED_BUCKETS;
|
||||||
ASSERT(agi->agi_unlinked[bucket_index] != cpu_to_be32(NULLAGINO));
|
if (!xfs_verify_agino(mp, agno,
|
||||||
ASSERT(agi->agi_unlinked[bucket_index]);
|
be32_to_cpu(agi->agi_unlinked[bucket_index]))) {
|
||||||
|
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
|
||||||
|
agi, sizeof(*agi));
|
||||||
|
return -EFSCORRUPTED;
|
||||||
|
}
|
||||||
|
|
||||||
if (be32_to_cpu(agi->agi_unlinked[bucket_index]) == agino) {
|
if (be32_to_cpu(agi->agi_unlinked[bucket_index]) == agino) {
|
||||||
/*
|
/*
|
||||||
|
@ -2171,8 +2176,12 @@ xfs_iunlink_remove(
|
||||||
|
|
||||||
last_offset = imap.im_boffset;
|
last_offset = imap.im_boffset;
|
||||||
next_agino = be32_to_cpu(last_dip->di_next_unlinked);
|
next_agino = be32_to_cpu(last_dip->di_next_unlinked);
|
||||||
ASSERT(next_agino != NULLAGINO);
|
if (!xfs_verify_agino(mp, agno, next_agino)) {
|
||||||
ASSERT(next_agino != 0);
|
XFS_CORRUPTION_ERROR(__func__,
|
||||||
|
XFS_ERRLEVEL_LOW, mp,
|
||||||
|
last_dip, sizeof(*last_dip));
|
||||||
|
return -EFSCORRUPTED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue