From a7cc4ab05af7b1ed4f16e8823fd0e6de2cfaad9c Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Fri, 20 Mar 2020 12:59:14 -0400 Subject: [PATCH] rbd-mirror: leader watcher should not cancel get locker if locker is invalid 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 --- src/tools/rbd_mirror/LeaderWatcher.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/rbd_mirror/LeaderWatcher.cc b/src/tools/rbd_mirror/LeaderWatcher.cc index 1581319219d..ae705e3c5e2 100644 --- a/src/tools/rbd_mirror/LeaderWatcher.cc +++ b/src/tools/rbd_mirror/LeaderWatcher.cc @@ -946,7 +946,7 @@ void LeaderWatcher::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); -- 2.39.5