xfs: do not use unchecked extent indices in xfs_bunmapi
Make sure to only call xfs_iext_get_ext after we've validate the extent index when moving on to the next index in xfs_bunmapi. Also remove the old workaround for too large indices that has been superceeded by the proper fix in xfs_bmap_del_extent. Based on an earlier patch from Lachlan McIlroy. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Lachlan McIlroy <lmcilroy@redhat.com> Signed-off-by: Alex Elder <aelder@sgi.com>
This commit is contained in:
committed by
Alex Elder
parent
5690f92199
commit
00239acf36
@@ -5242,17 +5242,17 @@ xfs_bunmapi(
|
|||||||
nodelete:
|
nodelete:
|
||||||
/*
|
/*
|
||||||
* If not done go on to the next (previous) record.
|
* If not done go on to the next (previous) record.
|
||||||
* Reset ep in case the extents array was re-alloced.
|
|
||||||
*/
|
*/
|
||||||
ep = xfs_iext_get_ext(ifp, lastx);
|
|
||||||
if (bno != (xfs_fileoff_t)-1 && bno >= start) {
|
if (bno != (xfs_fileoff_t)-1 && bno >= start) {
|
||||||
if (lastx >= XFS_IFORK_NEXTENTS(ip, whichfork) ||
|
if (lastx >= 0) {
|
||||||
xfs_bmbt_get_startoff(ep) > bno) {
|
|
||||||
if (--lastx >= 0)
|
|
||||||
ep = xfs_iext_get_ext(ifp, lastx);
|
ep = xfs_iext_get_ext(ifp, lastx);
|
||||||
|
if (xfs_bmbt_get_startoff(ep) > bno) {
|
||||||
|
if (--lastx >= 0)
|
||||||
|
ep = xfs_iext_get_ext(ifp,
|
||||||
|
lastx);
|
||||||
}
|
}
|
||||||
if (lastx >= 0)
|
|
||||||
xfs_bmbt_get_all(ep, &got);
|
xfs_bmbt_get_all(ep, &got);
|
||||||
|
}
|
||||||
extno++;
|
extno++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user