]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
librbd: improve debug log messages for managed lock
authorJason Dillaman <dillaman@redhat.com>
Fri, 3 Mar 2017 17:38:18 +0000 (12:38 -0500)
committerJason Dillaman <dillaman@redhat.com>
Fri, 10 Mar 2017 01:25:18 +0000 (20:25 -0500)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/ManagedLock.cc
src/librbd/managed_lock/AcquireRequest.cc
src/librbd/managed_lock/BreakRequest.cc
src/librbd/managed_lock/BreakRequest.h
src/librbd/managed_lock/ReleaseRequest.cc

index 76594d3c0fdb378dc1136ebbdaea98dead98aa8f..3661e2fbdb95b03db1f101f8551a379353a19dfa 100644 (file)
@@ -19,7 +19,8 @@
 
 #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 {
 
@@ -663,7 +664,6 @@ void ManagedLock<I>::send_shutdown() {
     return;
   }
 
-  ldout(m_cct, 10) << dendl;
   assert(m_state == STATE_LOCKED);
   m_state = STATE_PRE_SHUTTING_DOWN;
 
index b16c7597afe6f2401d3dad19bdbd281298f0080c..0249be2a14ea7d96726fe3a0d8fbf6c875de3126 100644 (file)
@@ -103,7 +103,8 @@ void AcquireRequest<I>::handle_get_locker(int r) {
 
 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,
index 8d81af2f123ac774efdee797d8723558970a6a55..6c4d4d208fe8435e39439819d14a2c25faf3453d 100644 (file)
@@ -93,21 +93,25 @@ void BreakRequest<I>::handle_get_watchers(int r) {
     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();
 }
 
index 277e79eb927a6b0a7e7cec570bd8697031cb9b21..045f629de291e71d1e31a623efb0f80e3bf24b48 100644 (file)
@@ -34,7 +34,8 @@ public:
                               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();
index ddc5e9740bf65f85f21acd033bc26c56d00337ee..0ccf674f00c5f29390584fe40c9f32d08c799ee6 100644 (file)
@@ -55,7 +55,8 @@ void ReleaseRequest<I>::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);