summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Bostic <keith@wiredtiger.com>2012-03-10 15:51:20 -0500
committerKeith Bostic <keith@wiredtiger.com>2012-03-10 15:51:20 -0500
commit9c495364fe4d71aee280c5ae128fde0b492e1431 (patch)
tree2d639820d33dace8021c3d1e4ffbc8b340010c04
parentb829f31011734b6e73609bfa0583a344a99e7f14 (diff)
downloadmongo-9c495364fe4d71aee280c5ae128fde0b492e1431.tar.gz
Previously, we assumed the underlying object would be removed if the
ref count was 1 and we called __wt_session_remove_btree; that's no longer the case, so we have to release our exclusive lock to avoid deadlock.
-rw-r--r--src/session/session_btree.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/session/session_btree.c b/src/session/session_btree.c
index 3cd39d7874c..a3dad604379 100644
--- a/src/session/session_btree.c
+++ b/src/session/session_btree.c
@@ -52,18 +52,14 @@ __wt_session_lock_btree(
WT_RET(__wt_try_writelock(session, btree->rwlock));
/*
- * Check if the handle needs to be reopened. If the handle was
- * just opened, cfg is NULL, so there is no need to reopen in
- * that case.
- *
+ * Check if the handle needs to be reopened for this operation.
* We do need to pick up the flags anyway, for example to set
* WT_BTREE_BULK so the handle is closed correctly.
*/
if (LF_ISSET(WT_BTREE_BULK |
WT_BTREE_SALVAGE | WT_BTREE_UPGRADE | WT_BTREE_VERIFY))
return (__wt_conn_btree_reopen(session, cfg, flags));
- else
- F_SET(btree, flags);
+ F_SET(btree, flags);
} else if (!LF_ISSET(WT_BTREE_NO_LOCK))
__wt_readlock(session, btree->rwlock);
@@ -175,7 +171,7 @@ __wt_session_get_btree(WT_SESSION_IMPL *session,
/*
* __wt_session_remove_btree --
- * Remove the btree handle from the session, closing if necessary.
+ * Discard our reference to the btree.
*/
int
__wt_session_remove_btree(
@@ -210,6 +206,7 @@ __wt_session_close_any_open_btree(WT_SESSION_IMPL *session, const char *name)
WT_ASSERT(session, btree_session->btree->refcnt == 1);
__wt_schema_detach_tree(session, btree_session->btree);
ret = __wt_session_remove_btree(session, btree_session);
+ __wt_rwunlock(session, session->btree->rwlock);
} else if (ret == WT_NOTFOUND)
ret = 0;