public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Always reset btree cursor after an insert
@ 2008-06-16  2:21 Lachlan McIlroy
  2008-06-16  5:01 ` Dave Chinner
  0 siblings, 1 reply; 6+ messages in thread
From: Lachlan McIlroy @ 2008-06-16  2:21 UTC (permalink / raw)
  To: xfs-dev, xfs-oss

After a btree insert operation a cursor can be invalid due to block
splits and a maybe a new root block.  We reset the cursor in
xfs_bmbt_insert() in the cases where we think we need to but it
isn't enough as we still see assertions.  Just do what we do elsewhere
and reset the cursor unconditionally.

Lachlan

--- fs/xfs/xfs_bmap.c_1.392	2008-06-03 12:20:14.000000000 +1000
+++ fs/xfs/xfs_bmap.c	2008-06-16 12:11:47.000000000 +1000
@@ -1745,11 +1745,17 @@ xfs_bmap_add_extent_unwritten_real(
 			if ((error = xfs_bmbt_insert(cur, &i)))
 				goto done;
 			ASSERT(i == 1);
-			if ((error = xfs_bmbt_increment(cur, 0, &i)))
+			/*
+			 * Reset the cursor, don't trust it after any insert
+			 * operation.
+			 */
+			if ((error = xfs_bmbt_lookup_eq(cur, new->br_startoff,
+					new->br_startblock, new->br_blockcount,
+					&i)))
 				goto done;
-			ASSERT(i == 1);
+			ASSERT(i == 0);
 			/* new middle extent - newext */
-			cur->bc_rec.b = *new;
+			cur->bc_rec.b.br_state = new->br_state;
 			if ((error = xfs_bmbt_insert(cur, &i)))
 				goto done;
 			ASSERT(i == 1);

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-06-17  5:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-16  2:21 [PATCH] Always reset btree cursor after an insert Lachlan McIlroy
2008-06-16  5:01 ` Dave Chinner
2008-06-16  6:41   ` Lachlan McIlroy
2008-06-16 17:14     ` Dave Chinner
2008-06-17  1:24       ` Lachlan McIlroy
2008-06-17  5:40         ` Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox