diff --git a/proxy/PluginVC.cc b/proxy/PluginVC.cc index 7b612c2a86b..7fe11124d9f 100644 --- a/proxy/PluginVC.cc +++ b/proxy/PluginVC.cc @@ -301,6 +301,9 @@ PluginVC::reenable(VIO * vio) ink_assert(magic == PLUGIN_VC_MAGIC_ALIVE); ink_assert(vio->mutex->thread_holding == this_ethread()); + Ptr sm_mutex = vio->mutex; + MUTEX_LOCK(lock, sm_mutex, this_ethread()); + Debug("pvc", "[%u] %s: reenable %s", core_obj->id, PVC_TYPE, (vio->op == VIO::WRITE) ? "Write" : "Read"); if (vio->op == VIO::WRITE) { @@ -365,6 +368,11 @@ PluginVC::do_io_close(int /* flag ATS_UNUSED */) Debug("pvc", "[%u] %s: do_io_close", core_obj->id, PVC_TYPE); + MUTEX_LOCK(lock, mutex, this_ethread()); + if (closed == true) { + return; + } + if (reentrancy_count > 0) { // Do nothing since dealloacting ourselves // now will lead to us running on a dead @@ -374,17 +382,9 @@ PluginVC::do_io_close(int /* flag ATS_UNUSED */) return; } - MUTEX_TRY_LOCK(lock, mutex, this_ethread()); - - if (!lock.is_locked()) { - setup_event_cb(PVC_LOCK_RETRY_TIME, &sm_lock_retry_event); - closed = true; - return; - } else { - closed = true; - } + setup_event_cb(PVC_LOCK_RETRY_TIME, &sm_lock_retry_event); + closed = true; - process_close(); } void