From 720fefebcc15acaff08b57bc36ac6ff3ff42716d Mon Sep 17 00:00:00 2001 From: Michael Cahill Date: Mon, 24 Nov 2014 12:34:52 +1100 Subject: 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 --- src/cursor/cur_file.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/cursor') 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)); -- cgit v1.2.1