summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Bostic <keith.bostic@mongodb.com>2016-09-22 19:48:43 -0400
committerAlex Gorrod <alexander.gorrod@mongodb.com>2016-09-23 09:48:43 +1000
commit38456fe978920136200997cb0150734cb6d2b948 (patch)
tree3c9d37b22bdb63829725149cf8fa2783d5b1377e
parentd40e5da96b02a344d71c88220ad969816bf99404 (diff)
downloadmongo-38456fe978920136200997cb0150734cb6d2b948.tar.gz
WT-2926 WT_CONNECTION.reconfigure can attempt unlock of not-locked lock (#3057)
Don't unlock the spin lock unless we've locked it.
-rw-r--r--src/conn/conn_api.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/conn/conn_api.c b/src/conn/conn_api.c
index faec72a4ac0..0951fd4e58c 100644
--- a/src/conn/conn_api.c
+++ b/src/conn/conn_api.c
@@ -1055,13 +1055,16 @@ __conn_reconfigure(WT_CONNECTION *wt_conn, const char *config)
WT_DECL_RET;
WT_SESSION_IMPL *session;
const char *p;
+ bool locked;
conn = (WT_CONNECTION_IMPL *)wt_conn;
+ locked = false;
CONNECTION_API_CALL(conn, session, reconfigure, config, cfg);
/* Serialize reconfiguration. */
__wt_spin_lock(session, &conn->reconfig_lock);
+ locked = true;
/*
* The configuration argument has been checked for validity, update the
@@ -1096,7 +1099,8 @@ __conn_reconfigure(WT_CONNECTION *wt_conn, const char *config)
__wt_free(session, conn->cfg);
conn->cfg = p;
-err: __wt_spin_unlock(session, &conn->reconfig_lock);
+err: if (locked)
+ __wt_spin_unlock(session, &conn->reconfig_lock);
API_END_RET(session, ret);
}
@@ -1117,11 +1121,11 @@ __conn_open_session(WT_CONNECTION *wt_conn,
*wt_sessionp = NULL;
conn = (WT_CONNECTION_IMPL *)wt_conn;
- session_ret = NULL;
CONNECTION_API_CALL(conn, session, open_session, config, cfg);
WT_UNUSED(cfg);
+ session_ret = NULL;
WT_ERR(__wt_open_session(
conn, event_handler, config, true, &session_ret));
*wt_sessionp = &session_ret->iface;