From 7faa8d65f8f18284750ede708bcb3c0d9dbe73b6 Mon Sep 17 00:00:00 2001 From: Michael Cahill Date: Tue, 26 May 2015 12:08:07 +1000 Subject: Hold the schema and handle list locks while LSM is discarding a chunk. This avoids a deadlock in the MongoDB 3.0 branch that has been fixed in WiredTiger 2.6 by changes to handle locking. refs WT-1945 --- src/lsm/lsm_work_unit.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/lsm/lsm_work_unit.c b/src/lsm/lsm_work_unit.c index 15ba07664cc..0566e0abc70 100644 --- a/src/lsm/lsm_work_unit.c +++ b/src/lsm/lsm_work_unit.c @@ -446,11 +446,11 @@ err: if (bloom != NULL) } /* - * __lsm_discard_handle -- - * Try to discard a handle from cache. + * __lsm_discard_handle_internal -- + * Try to discard a handle from cache (locked version). */ static int -__lsm_discard_handle( +__lsm_discard_handle_internal( WT_SESSION_IMPL *session, const char *uri, const char *checkpoint) { /* This will fail with EBUSY if the file is still in use. */ @@ -461,6 +461,23 @@ __lsm_discard_handle( return (__wt_session_release_btree(session)); } +/* + * __lsm_discard_handle -- + * Try to discard a handle from cache. + */ +static int +__lsm_discard_handle( + WT_SESSION_IMPL *session, const char *uri, const char *checkpoint) +{ + WT_DECL_RET; + + WT_WITH_SCHEMA_LOCK(session, + WT_WITH_DHANDLE_LOCK(session, + ret = __lsm_discard_handle_internal(session, uri, checkpoint))); + + return (ret); +} + /* * __lsm_drop_file -- * Helper function to drop part of an LSM tree. -- cgit v1.2.3