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
commit91df4329c384322750abb15691ec8005ddb4dd11 (patch)
treea724868791154785b9333478d1dd0792ce4f1062
parent9bb5bbacb55922985283844c1901ddd6c4f97e72 (diff)
downloadmongo-91df4329c384322750abb15691ec8005ddb4dd11.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)