]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Merge pull request #57452 from joscollin/wip-65991-quincy
authorVenky Shankar <vshankar@redhat.com>
Thu, 2 Jan 2025 09:23:48 +0000 (14:53 +0530)
committerGitHub <noreply@github.com>
Thu, 2 Jan 2025 09:23:48 +0000 (14:53 +0530)
quincy: cephfs_mirror: fix crash in update_fs_mirrors()

Reviewed-by: Venky Shankar <vshankar@redhat.com>
1  2 
src/tools/cephfs_mirror/FSMirror.h

index 2fc91cec22f7f0ec883f21b64b05364742ee8b1a,dd0b135d78b633904e0496d125c54f193ca39645..9684b74620e831c257bea7269e08ce974e4d804e
@@@ -47,19 -47,26 +47,24 @@@ public
  
    bool is_failed() {
      std::scoped_lock locker(m_lock);
-     return m_init_failed ||
-            m_instance_watcher->is_failed() ||
-            m_mirror_watcher->is_failed();
+     bool failed = m_init_failed;
+     if (m_instance_watcher) {
+       failed |= m_instance_watcher->is_failed();
+     }
+     if (m_mirror_watcher) {
+       failed |= m_mirror_watcher->is_failed();
+     }
+     return failed;
    }
  
 -  utime_t get_failed_ts() {
 +  monotime get_failed_ts() {
      std::scoped_lock locker(m_lock);
 -    if (m_instance_watcher) {
 -      return m_instance_watcher->get_failed_ts();
 -    }
 -    if (m_mirror_watcher) {
 -      return m_mirror_watcher->get_failed_ts();
 -    }
 +    return m_failed_ts;
 +  }
  
 -    return utime_t();
 +  void set_failed_ts() {
 +    std::scoped_lock locker(m_lock);
 +    m_failed_ts = clock::now();
    }
  
    bool is_blocklisted() {