Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 339424
b: refs/heads/master
c: bb80c6d
h: refs/heads/master
v: v3
  • Loading branch information
Dave Chinner authored and Ben Myers committed Nov 16, 2012
1 parent 7f63789 commit b7b6ee4
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3702ce6ed71cd60451ab278088863456dcb0dd99
refs/heads/master: bb80c6d79a3b0f9b6c3236a4bec021c72615bfd1
39 changes: 38 additions & 1 deletion trunk/fs/xfs/xfs_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,43 @@ xfs_alloc_fixup_trees(
return 0;
}

void
xfs_agfl_read_verify(
struct xfs_buf *bp)
{
#ifdef WHEN_CRCS_COME_ALONG
/*
* we cannot actually do any verification of the AGFL because mkfs does
* not initialise the AGFL to zero or NULL. Hence the only valid part of
* the AGFL is what the AGF says is active. We can't get to the AGF, so
* we can't verify just those entries are valid.
*
* This problem goes away when the CRC format change comes along as that
* requires the AGFL to be initialised by mkfs. At that point, we can
* verify the blocks in the agfl -active or not- lie within the bounds
* of the AG. Until then, just leave this check ifdef'd out.
*/
struct xfs_mount *mp = bp->b_target->bt_mount;
struct xfs_agfl *agfl = XFS_BUF_TO_AGFL(bp);
int agfl_ok = 1;

int i;

for (i = 0; i < XFS_AGFL_SIZE(mp); i++) {
if (be32_to_cpu(agfl->agfl_bno[i]) == NULLAGBLOCK ||
be32_to_cpu(agfl->agfl_bno[i]) >= mp->m_sb.sb_agblocks)
agfl_ok = 0;
}

if (!agfl_ok) {
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, agfl);
xfs_buf_ioerror(bp, EFSCORRUPTED);
}
#endif
bp->b_iodone = NULL;
xfs_buf_ioend(bp, 0);
}

/*
* Read in the allocation group free block array.
*/
Expand All @@ -447,7 +484,7 @@ xfs_alloc_read_agfl(
error = xfs_trans_read_buf(
mp, tp, mp->m_ddev_targp,
XFS_AG_DADDR(mp, agno, XFS_AGFL_DADDR(mp)),
XFS_FSS_TO_BB(mp, 1), 0, &bp, NULL);
XFS_FSS_TO_BB(mp, 1), 0, &bp, xfs_agfl_read_verify);
if (error)
return error;
ASSERT(!xfs_buf_geterror(bp));
Expand Down

0 comments on commit b7b6ee4

Please sign in to comment.