Disabling exclusive lock will now acquire the exclusive lock before
proceeding. If this resulted in another client releasing the lock
and re-requesting it, support for exclusive locking might be disabled
while a request is pending.
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
void ExclusiveLock<I>::shut_down(Context *on_shut_down) {
ldout(m_image_ctx.cct, 10) << this << " " << __func__ << dendl;
- Mutex::Locker locker(m_lock);
- assert(!is_shutdown());
- execute_action(ACTION_SHUT_DOWN, on_shut_down);
+ {
+ Mutex::Locker locker(m_lock);
+ assert(!is_shutdown());
+ execute_action(ACTION_SHUT_DOWN, on_shut_down);
+ }
+
+ // if stalled in request state machine -- abort
+ handle_lock_released();
}
template <typename I>
RWLock::RLocker owner_locker(m_image_ctx.owner_lock);
RWLock::RLocker snap_locker(m_image_ctx.snap_lock);
- // ExclusiveLock state machine cannot transition
- assert(!m_image_ctx.exclusive_lock->is_lock_owner());
+ // ExclusiveLock state machine cannot transition -- but can be
+ // dynamically disabled
+ if (m_image_ctx.exclusive_lock == nullptr) {
+ return;
+ }
if (r == -ETIMEDOUT) {
ldout(m_image_ctx.cct, 5) << this << " timed out requesting lock: retrying"