summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Gorrod <alexg@wiredtiger.com>2015-01-17 22:25:02 +0000
committerAlex Gorrod <alexg@wiredtiger.com>2015-01-17 22:25:02 +0000
commitf61f984cf5241ac54bc2ea368c8c15e0cdfa91aa (patch)
treee52eec8e063ec5d943bb680b12c2df14c7744c45
parent010059e721d1c6bd4d81214ab80402866de41345 (diff)
downloadmongo-f61f984cf5241ac54bc2ea368c8c15e0cdfa91aa.tar.gz
Fix a deadlock opening statistics cursors.
Refs #1575 and JIRA SERVER-16738
-rw-r--r--src/cursor/cur_stat.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/cursor/cur_stat.c b/src/cursor/cur_stat.c
index 5086160b233..e3364ad8009 100644
--- a/src/cursor/cur_stat.c
+++ b/src/cursor/cur_stat.c
@@ -408,11 +408,15 @@ __curstat_file_init(WT_SESSION_IMPL *session,
* We're likely holding the handle lock inside the statistics
* logging thread, not to mention calling __wt_conn_btree_apply
* from there as well. Save/restore the handle.
+ * Take the schema lock now, in case btree apply needs to
+ * get it later - that would violate lock ordering
+ * conventions and can lead to deadlocks.
*/
saved_dhandle = dhandle;
- WT_WITH_DHANDLE_LOCK(session,
- ret = __wt_conn_btree_apply(
- session, 1, dhandle->name, __curstat_checkpoint, cfg_arg));
+ WT_WITH_SCHEMA_LOCK(session,
+ WT_WITH_DHANDLE_LOCK(session,
+ ret = __wt_conn_btree_apply(session,
+ 1, dhandle->name, __curstat_checkpoint, cfg_arg)));
session->dhandle = saved_dhandle;
}