From 8317ce1611c39ad6a58bf2d760a010587d91ec60 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Thu, 16 Jun 2016 10:37:56 -0400 Subject: [PATCH] journal: do not log watch errors against deleted journal The peer rbd-mirror process will eventually notice that the journal has been removed and clean itself up. This avoids flooding the log with expected error messages when journaling is disabled. Signed-off-by: Jason Dillaman --- src/journal/JournalMetadata.cc | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/journal/JournalMetadata.cc b/src/journal/JournalMetadata.cc index 18bef13b0f99..ed586a350ed7 100644 --- a/src/journal/JournalMetadata.cc +++ b/src/journal/JournalMetadata.cc @@ -824,7 +824,7 @@ void JournalMetadata::handle_commit_position_task() { void JournalMetadata::schedule_watch_reset() { assert(m_timer_lock->is_locked()); - m_timer->add_event_after(0.1, new C_WatchReset(this)); + m_timer->add_event_after(1, new C_WatchReset(this)); } void JournalMetadata::handle_watch_reset() { @@ -835,8 +835,12 @@ void JournalMetadata::handle_watch_reset() { int r = m_ioctx.watch2(m_oid, &m_watch_handle, &m_watch_ctx); if (r < 0) { - lderr(m_cct) << __func__ << ": failed to watch journal" - << cpp_strerror(r) << dendl; + if (r == -ENOENT) { + ldout(m_cct, 5) << __func__ << ": journal header not found" << dendl; + } else { + lderr(m_cct) << __func__ << ": failed to watch journal" + << cpp_strerror(r) << dendl; + } schedule_watch_reset(); } else { ldout(m_cct, 10) << __func__ << ": reset journal watch" << dendl; @@ -854,7 +858,12 @@ void JournalMetadata::handle_watch_notify(uint64_t notify_id, uint64_t cookie) { } void JournalMetadata::handle_watch_error(int err) { - lderr(m_cct) << "journal watch error: " << cpp_strerror(err) << dendl; + if (err == -ENOTCONN) { + ldout(m_cct, 5) << "journal watch error: header removed" << dendl; + } else { + lderr(m_cct) << "journal watch error: " << cpp_strerror(err) << dendl; + } + Mutex::Locker timer_locker(*m_timer_lock); Mutex::Locker locker(m_lock); -- 2.47.3