#define dout_subsys ceph_subsys_rbd
#undef dout_prefix
-#define dout_prefix *_dout << "librbd::ManagedLock: " << this << " " << __func__
+#define dout_prefix *_dout << "librbd::ManagedLock: " << this << " " \
+ << __func__
namespace librbd {
return;
}
- ldout(m_cct, 10) << dendl;
assert(m_state == STATE_LOCKED);
m_state = STATE_PRE_SHUTTING_DOWN;
template <typename I>
void AcquireRequest<I>::send_lock() {
- ldout(m_cct, 10) << "cookie=" << m_cookie << dendl;
+ ldout(m_cct, 10) << "entity=client." << m_ioctx.get_instance_id() << ", "
+ << "cookie=" << m_cookie << dendl;
librados::ObjectWriteOperation op;
rados::cls::lock::lock(&op, RBD_LOCK_NAME,
return;
}
+ bool found_alive_locker = false;
for (auto &watcher : m_watchers) {
+ ldout(m_cct, 20) << "watcher=["
+ << "addr=" << watcher.addr << ", "
+ << "entity=client." << watcher.watcher_id << "]" << dendl;
+
if ((strncmp(m_locker.address.c_str(),
watcher.addr, sizeof(watcher.addr)) == 0) &&
(m_locker.handle == watcher.cookie)) {
ldout(m_cct, 10) << "lock owner is still alive" << dendl;
-
- if (m_force_break_lock) {
- break;
- } else {
- finish(-EAGAIN);
- return;
- }
+ found_alive_locker = true;
}
}
+ if (!m_force_break_lock && found_alive_locker) {
+ finish(-EAGAIN);
+ return;
+ }
+
send_blacklist();
}
uint32_t blacklist_expire_seconds,
bool force_break_lock, Context *on_finish) {
return new BreakRequest(ioctx, work_queue, oid, locker, blacklist_locker,
- blacklist_expire_seconds, force_break_lock, on_finish);
+ blacklist_expire_seconds, force_break_lock,
+ on_finish);
}
void send();
template <typename I>
void ReleaseRequest<I>::send_unlock() {
CephContext *cct = reinterpret_cast<CephContext *>(m_ioctx.cct());
- ldout(cct, 10) << "cookie=" << m_cookie << dendl;
+ ldout(cct, 10) << "entity=client." << m_ioctx.get_instance_id() << ", "
+ << "cookie=" << m_cookie << dendl;
librados::ObjectWriteOperation op;
rados::cls::lock::unlock(&op, RBD_LOCK_NAME, m_cookie);