]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-mirror: leader watcher should not cancel get locker if locker is invalid 34040/head
authorJason Dillaman <dillaman@redhat.com>
Fri, 20 Mar 2020 16:59:14 +0000 (12:59 -0400)
committerJason Dillaman <dillaman@redhat.com>
Fri, 20 Mar 2020 17:18:14 +0000 (13:18 -0400)
When a new leader acquires the lock, it will send out a lock acquired
notification along with periodic heartbeats. The get locker will attempt to
run immediately, but if a heartbeat arrives before it executes the heartbeat
will cancel the timer and reschedule it for the future. This process repeats
for each periodic heartbeat and the locker is never re-read from the OSD.

This is an issue only for namespace replayers due to the delayed fashion in
which the leader instance id is retrieved.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/tools/rbd_mirror/LeaderWatcher.cc

index 1581319219dc1a431bc97e9bccf29686d9d0ecd4..ae705e3c5e263442abf5b35d0f2d1d5b8a48c7bc 100644 (file)
@@ -946,7 +946,7 @@ void LeaderWatcher<I>::handle_heartbeat(Context *on_notify_ack) {
     std::scoped_lock locker{m_threads->timer_lock, m_lock};
     if (is_leader(m_lock)) {
       dout(5) << "got another leader heartbeat, ignoring" << dendl;
-    } else {
+    } else if (!m_locker.cookie.empty()) {
       cancel_timer_task();
       m_acquire_attempts = 0;
       schedule_acquire_leader_lock(1);