<< dendl;
// treat this is a dead client -- so retest acquiring the lock
- m_image_ctx.exclusive_lock->handle_lock_released();
+ m_image_ctx.exclusive_lock->handle_peer_notification();
} else if (r < 0) {
lderr(m_image_ctx.cct) << this << " error requesting lock: "
<< cpp_strerror(r) << dendl;
}
RWLock::RLocker owner_locker(m_image_ctx.owner_lock);
+ if (m_image_ctx.exclusive_lock != nullptr) {
+ // potentially wake up the exclusive lock state machine now that
+ // a lock owner has advertised itself
+ m_image_ctx.exclusive_lock->handle_peer_notification();
+ }
if (cancel_async_requests &&
(m_image_ctx.exclusive_lock == nullptr ||
!m_image_ctx.exclusive_lock->is_lock_owner())) {
if (m_image_ctx.exclusive_lock != nullptr &&
!m_image_ctx.exclusive_lock->is_lock_owner()) {
m_task_finisher->cancel(TASK_CODE_REQUEST_LOCK);
- m_image_ctx.exclusive_lock->handle_lock_released();
+ m_image_ctx.exclusive_lock->handle_peer_notification();
}
return true;
}
}
RWLock::RLocker l(m_image_ctx.owner_lock);
- if (m_image_ctx.exclusive_lock != nullptr) {
- int r;
- if (m_image_ctx.exclusive_lock->accept_requests(&r)) {
- // need to send something back so the client can detect a missing leader
- ::encode(ResponseMessage(0), ack_ctx->out);
-
- {
- Mutex::Locker owner_client_id_locker(m_owner_client_id_lock);
- if (!m_owner_client_id.is_valid()) {
- return true;
- }
+ if (m_image_ctx.exclusive_lock != nullptr &&
+ m_image_ctx.exclusive_lock->is_lock_owner()) {
+ int r = 0;
+ bool accept_request = m_image_ctx.exclusive_lock->accept_requests(&r);
+
+ // need to send something back so the client can detect a missing leader
+ ::encode(ResponseMessage(r), ack_ctx->out);
+
+ if (accept_request) {
+ Mutex::Locker owner_client_id_locker(m_owner_client_id_lock);
+ if (!m_owner_client_id.is_valid()) {
+ return true;
}
ldout(m_image_ctx.cct, 10) << this << " queuing release of exclusive lock"
<< dendl;
m_image_ctx.get_exclusive_lock_policy()->lock_requested(payload.force);
- } else if (r < 0) {
- ::encode(ResponseMessage(r), ack_ctx->out);
}
}
return true;