HAMMER VFS - Hack cursor iterator when locked cursor moved to parent
authorMatthew Dillon <dillon@apollo.backplane.com>
Mon, 15 Mar 2010 17:49:03 +0000 (15 10:49 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Mon, 15 Mar 2010 17:49:03 +0000 (15 10:49 -0700)
* A cursor is also moved to its parent normally when deleting the last
  element in a node and that node is then destroyed.

Reported-by: YONETANI Tomokazu <qhwt+dfly@les.ath.cx>
sys/vfs/hammer/hammer_btree.c

index 8a6ce34..91cb117 100644 (file)
@@ -2418,8 +2418,11 @@ btree_remove(hammer_cursor_t cursor)
 
                /*
                 * cursor->node is invalid, cursor up to make the cursor
-                * valid again.
+                * valid again.  We have to flag the condition in case
+                * another thread wiggles an insertion in during an
+                * iteration.
                 */
+               cursor->flags |= HAMMER_CURSOR_ITERATE_CHECK;
                error = hammer_cursor_up(cursor);
        }
        return (error);