Review: xfs_bmapi does not update previous extent pointer correctly
When looping across multiple extents, xfs_bmapi will fail to update the previous extent pointer which is used in subsequent loops.
As a result, we can end up with the second loop in xfs_bmapi trying to use an incorrect previous extent pointer and assert failures or corrupted in-memory extent lists will result.
Correctly update the previous extent at the end of each loop so that we DTRT when processing multiple map requests.
Cheers,
Dave.
Signature · 26 lines
Dave Chinner
Principal Engineer
SGI Australian Software Group
---
fs/xfs/xfs_bmap.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Index: 2.6.x-xfs-new/fs/xfs/xfs_bmap.c
===================================================================
--- 2.6.x-xfs-new.orig/fs/xfs/xfs_bmap.c 2007-05-23 16:33:00.000000000 +1000
+++ 2.6.x-xfs-new/fs/xfs/xfs_bmap.c 2007-05-25 11:53:31.949847746 +1000
@@ -5575,10 +5575,10 @@ xfs_bmapi(
* Else go on to the next record.
*/
ep = xfs_iext_get_ext(ifp, ++lastx);
- if (lastx >= nextents) {
+ prev = got;
+ if (lastx >= nextents)
eof = 1;
- prev = got;
- } else
+ else
xfs_bmbt_get_all(ep, &got);
}
ifp->if_lastex = lastx;It is looking good Dave,
Regards,
Vlad
Quoted 15 lines · David Chinner
When looping across multiple extents,
xfs_bmapiwill fail to update the previous extent pointer which is used in subsequent loops.As a result, we can end up with the second loop in
xfs_bmapitrying to use an incorrect previous extent pointer and assert failures or corrupted in-memory extent lists will result.Correctly update the previous extent at the end of each loop so that we DTRT when processing multiple map requests.
Cheers,
Dave.