aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2018-06-04 14:27:51 -0400
committerDarrick J. Wong <darrick.wong@oracle.com>2018-06-04 21:25:05 -0400
commitd2e736654247dcfe98e2b86fa2ee77fb36292144 (patch)
tree460d2d1594c215e0455ebb183ec6b1442fb4f387
parent2551a53053de52993be8752731f084fad3cfc4d8 (diff)
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>
-rw-r--r--fs/xfs/xfs_inode.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 05207a64dd53..c85ae83e007f 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -2090,10 +2090,15 @@ xfs_iunlink_remove(
2090 * list this inode will go on. 2090 * list this inode will go on.
2091 */ 2091 */
2092 agino = XFS_INO_TO_AGINO(mp, ip->i_ino); 2092 agino = XFS_INO_TO_AGINO(mp, ip->i_ino);
2093 ASSERT(agino != 0); 2093 if (!xfs_verify_agino(mp, agno, agino))
2094 return -EFSCORRUPTED;
2094 bucket_index = agino % XFS_AGI_UNLINKED_BUCKETS; 2095 bucket_index = agino % XFS_AGI_UNLINKED_BUCKETS;
2095 ASSERT(agi->agi_unlinked[bucket_index] != cpu_to_be32(NULLAGINO)); 2096 if (!xfs_verify_agino(mp, agno,
2096 ASSERT(agi->agi_unlinked[bucket_index]); 2097 be32_to_cpu(agi->agi_unlinked[bucket_index]))) {
2098 XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
2099 agi, sizeof(*agi));
2100 return -EFSCORRUPTED;
2101 }
2097 2102
2098 if (be32_to_cpu(agi->agi_unlinked[bucket_index]) == agino) { 2103 if (be32_to_cpu(agi->agi_unlinked[bucket_index]) == agino) {
2099 /* 2104 /*
@@ -2171,8 +2176,12 @@ xfs_iunlink_remove(
2171 2176
2172 last_offset = imap.im_boffset; 2177 last_offset = imap.im_boffset;
2173 next_agino = be32_to_cpu(last_dip->di_next_unlinked); 2178 next_agino = be32_to_cpu(last_dip->di_next_unlinked);
2174 ASSERT(next_agino != NULLAGINO); 2179 if (!xfs_verify_agino(mp, agno, next_agino)) {
2175 ASSERT(next_agino != 0); 2180 XFS_CORRUPTION_ERROR(__func__,
2181 XFS_ERRLEVEL_LOW, mp,
2182 last_dip, sizeof(*last_dip));
2183 return -EFSCORRUPTED;
2184 }
2176 } 2185 }
2177 2186
2178 /* 2187 /*