summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@wiredtiger.com>2014-12-19 17:19:58 +1100
committerMichael Cahill <michael.cahill@wiredtiger.com>2014-12-19 17:19:58 +1100
commite913b0811114d65b543cd78824e809eb487fd330 (patch)
tree8e2a1af3544141cc43069346193868b8e3923381
parent0d21e437917bc7cf08393852a3074957431ea30e (diff)
downloadmongo-e913b0811114d65b543cd78824e809eb487fd330.tar.gz
Check that handles are not being walked by eviction before discarding.
refs #1497
-rw-r--r--src/conn/conn_dhandle.c3
-rw-r--r--src/conn/conn_sweep.c2
2 files changed, 3 insertions, 2 deletions
diff --git a/src/conn/conn_dhandle.c b/src/conn/conn_dhandle.c
index 5d5a67ccac8..6d331f691fd 100644
--- a/src/conn/conn_dhandle.c
+++ b/src/conn/conn_dhandle.c
@@ -667,7 +667,8 @@ __conn_dhandle_remove(WT_SESSION_IMPL *session, int final)
WT_ASSERT(session, F_ISSET(session, WT_SESSION_HANDLE_LIST_LOCKED));
/* Check if the handle was reacquired by a session while we waited. */
- if (!final && dhandle->session_ref != 0)
+ if (!final &&
+ (dhandle->session_inuse != 0 || dhandle->session_ref != 0))
return (EBUSY);
WT_CONN_DHANDLE_REMOVE(conn, dhandle, bucket);
diff --git a/src/conn/conn_sweep.c b/src/conn/conn_sweep.c
index afb84472a18..5916043e44f 100644
--- a/src/conn/conn_sweep.c
+++ b/src/conn/conn_sweep.c
@@ -79,7 +79,7 @@ __sweep(WT_SESSION_IMPL *session)
* re-checks that the handle is not in use, which is why we
* don't do any special handling of EBUSY returns above.
*/
- if (dhandle->session_ref == 0) {
+ if (dhandle->session_inuse == 0 && dhandle->session_ref == 0) {
WT_WITH_DHANDLE(session, dhandle,
ret = __wt_conn_dhandle_discard_single(session, 0));
if (ret != 0)