From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: with ECARTIS (v1.0.0; list xfs); Sun, 15 Jun 2008 19:17:22 -0700 (PDT) Received: from larry.melbourne.sgi.com (larry.melbourne.sgi.com [134.14.52.130]) by oss.sgi.com (8.12.11.20060308/8.12.11/SuSE Linux 0.7) with SMTP id m5G2HH02027669 for ; Sun, 15 Jun 2008 19:17:19 -0700 Message-ID: <4855CE2D.70505@sgi.com> Date: Mon, 16 Jun 2008 12:21:33 +1000 From: Lachlan McIlroy Reply-To: lachlan@sgi.com MIME-Version: 1.0 Subject: [PATCH] Always reset btree cursor after an insert Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: xfs-bounce@oss.sgi.com Errors-to: xfs-bounce@oss.sgi.com List-Id: xfs 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);