From: Lachlan McIlroy <lachlan@sgi.com>
To: xfs-dev <xfs-dev@sgi.com>, xfs-oss <xfs@oss.sgi.com>
Subject: [PATCH] Always reset btree cursor after an insert
Date: Mon, 16 Jun 2008 12:21:33 +1000 [thread overview]
Message-ID: <4855CE2D.70505@sgi.com> (raw)
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);
next reply other threads:[~2008-06-16 2:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-16 2:21 Lachlan McIlroy [this message]
2008-06-16 5:01 ` [PATCH] Always reset btree cursor after an insert 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4855CE2D.70505@sgi.com \
--to=lachlan@sgi.com \
--cc=xfs-dev@sgi.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox