xfs
[Top] [All Lists]

Review: xfs_bmapi does not update previous extent pointer correctly

To: xfs-dev <xfs-dev@xxxxxxx>
Subject: Review: xfs_bmapi does not update previous extent pointer correctly
From: David Chinner <dgc@xxxxxxx>
Date: Mon, 4 Jun 2007 15:19:44 +1000
Cc: xfs-oss <xfs@xxxxxxxxxxx>
Sender: xfs-bounce@xxxxxxxxxxx
User-agent: Mutt/1.4.2.1i
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.
-- 
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;


<Prev in Thread] Current Thread [Next in Thread>