summaryrefslogtreecommitdiff
path: root/src/cursor
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@wiredtiger.com>2014-11-24 12:34:52 +1100
committerMichael Cahill <michael.cahill@wiredtiger.com>2014-11-24 12:34:52 +1100
commit720fefebcc15acaff08b57bc36ac6ff3ff42716d (patch)
treedac328c8273b1bedf5bd94d502c8ec830e56d785 /src/cursor
parente9a4ea8aa4d95d6cacbb55e06d8755d732fb0e0e (diff)
downloadmongo-720fefebcc15acaff08b57bc36ac6ff3ff42716d.tar.gz
Fix some issues with the recent changes to handle locking:
1) bump the reference count before dropping the handle list lock. Otherwise, a handle sweep could free the handle from under us in between. 2) hold the handle exclusive until sweep is finished with it. Previously it could have been re-acquired in between, and the locking situation was unclear. refs #1391, #1392
Diffstat (limited to 'src/cursor')
-rw-r--r--src/cursor/cur_file.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/cursor/cur_file.c b/src/cursor/cur_file.c
index 1629c5e46ff..caa2a938954 100644
--- a/src/cursor/cur_file.c
+++ b/src/cursor/cur_file.c
@@ -462,17 +462,15 @@ __wt_curfile_open(WT_SESSION_IMPL *session, const char *uri,
* holding the checkpoint lock. This prevents a bulk cursor
* open failing with EBUSY due to a database-wide checkpoint.
*/
- if (bulk) {
+ if (bulk)
__wt_spin_lock(
session, &S2C(session)->checkpoint_lock);
- ret = __wt_session_get_btree_ckpt(
- session, uri, cfg, flags);
+ ret = __wt_session_get_btree_ckpt(
+ session, uri, cfg, flags);
+ if (bulk)
__wt_spin_unlock(
session, &S2C(session)->checkpoint_lock);
- WT_RET(ret);
- } else
- WT_RET(__wt_session_get_btree_ckpt(
- session, uri, cfg, flags));
+ WT_RET(ret);
} else
WT_RET(__wt_bad_object_type(session, uri));