@@ -59,14 +59,12 @@ class FSMirror {
5959
6060 monotime get_failed_ts () {
6161 std::scoped_lock locker (m_lock);
62- if (m_instance_watcher) {
63- return m_instance_watcher->get_failed_ts ();
64- }
65- if (m_mirror_watcher) {
66- return m_mirror_watcher->get_failed_ts ();
67- }
62+ return m_failed_ts;
63+ }
6864
69- return clock::now ();
65+ void set_failed_ts () {
66+ std::scoped_lock locker (m_lock);
67+ m_failed_ts = clock::now ();
7068 }
7169
7270 bool is_blocklisted () {
@@ -76,14 +74,12 @@ class FSMirror {
7674
7775 monotime get_blocklisted_ts () {
7876 std::scoped_lock locker (m_lock);
79- if (m_instance_watcher) {
80- return m_instance_watcher->get_blocklisted_ts ();
81- }
82- if (m_mirror_watcher) {
83- return m_mirror_watcher->get_blocklisted_ts ();
84- }
77+ return m_blocklisted_ts;
78+ }
8579
86- return clock::now ();
80+ void set_blocklisted_ts () {
81+ std::scoped_lock locker (m_lock);
82+ m_blocklisted_ts = clock::now ();
8783 }
8884
8985 Peers get_peers () {
@@ -128,8 +124,24 @@ class FSMirror {
128124 void release_directory (std::string_view dir_path) override {
129125 fs_mirror->handle_release_directory (dir_path);
130126 }
127+
128+ };
129+
130+ struct TimestampListener : public Watcher ::ErrorListener {
131+ FSMirror *fs_mirror;
132+ TimestampListener (FSMirror *fs_mirror)
133+ : fs_mirror(fs_mirror) {
134+ }
135+ void set_blocklisted_ts () {
136+ fs_mirror->set_blocklisted_ts ();
137+ }
138+ void set_failed_ts () {
139+ fs_mirror->set_failed_ts ();
140+ }
131141 };
132142
143+ monotime m_blocklisted_ts;
144+ monotime m_failed_ts;
133145 CephContext *m_cct;
134146 Filesystem m_filesystem;
135147 uint64_t m_pool_id;
@@ -139,6 +151,7 @@ class FSMirror {
139151
140152 ceph::mutex m_lock = ceph::make_mutex(" cephfs::mirror::fs_mirror" );
141153 SnapListener m_snap_listener;
154+ TimestampListener m_ts_listener;
142155 std::set<std::string, std::less<>> m_directories;
143156 Peers m_all_peers;
144157 std::map<Peer, std::unique_ptr<PeerReplayer>> m_peer_replayers;
0 commit comments