From e913b0811114d65b543cd78824e809eb487fd330 Mon Sep 17 00:00:00 2001 From: Michael Cahill Date: Fri, 19 Dec 2014 17:19:58 +1100 Subject: Check that handles are not being walked by eviction before discarding. refs #1497 --- src/conn/conn_dhandle.c | 3 ++- src/conn/conn_sweep.c | 2 +- 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) -- cgit v1.2.1