]> pilppa.org Git - linux-2.6-omap-h63xx.git/commit
[XFS] Prevent looping in xfs_sync_inodes_ag
authorDavid Chinner <david@fromorbit.com>
Thu, 30 Oct 2008 06:38:00 +0000 (17:38 +1100)
committerLachlan McIlroy <lachlan@sgi.com>
Thu, 30 Oct 2008 06:38:00 +0000 (17:38 +1100)
commit8c38ab032094ff1d903c79db689607b1ebae13ca
tree06148b37fd9706e842d7653adcd9e9ac83a73f53
parent116545130cbc5214523c2f994a11c81ef9eb9186
[XFS] Prevent looping in xfs_sync_inodes_ag

If the last block of the AG has inodes in it and the AG is an exactly
power-of-2 size then the last inode in the AG points to the last block in
the AG. If we try to find the next inode in the AG by adding one to the
inode number, we increment the inode number past the size of the AG. The
result is that the macro XFS_INO_TO_AGINO() will strip the AG portion of
the inode number and return an inode number of zero.

That is, instead of terminating the lookup loop because we hit the inode
number went outside the valid range for the AG, the search index returns
to zero and we start traversing the radix tree from the start again. This
results in an endless loop in xfs_sync_inodes_ag().

Fix it be detecting if the new search index decreases as a result of
incrementing the current inode number. That indicate an overflow and hence
that we have finished processing the AG so we can terminate the loop.

SGI-PV: 988142

SGI-Modid: xfs-linux-melb:xfs-kern:32335a

Signed-off-by: David Chinner <david@fromorbit.com>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Signed-off-by: Christoph Hellwig <hch@infradead.org>
fs/xfs/linux-2.6/xfs_sync.c