.set_description("")
.set_long_description(""),
+ Option("cephfs_mirror_restart_mirror_on_blocklist_interval", Option::TYPE_SECS, Option::LEVEL_ADVANCED)
+ .set_default(30)
+ .set_min(0)
+ .set_description("")
+ .set_long_description(""),
+
});
}
f->open_object_section("status");
if (m_init_failed) {
f->dump_string("state", "failed");
+ } else if (is_blocklisted(locker)) {
+ f->dump_string("state", "blocklisted");
} else {
f->open_object_section("peers");
for ([[maybe_unused]] auto &[peer, peer_replayer] : m_peer_replayers) {
return m_init_failed;
}
+ bool is_blocklisted() {
+ std::scoped_lock locker(m_lock);
+ return is_blocklisted(locker);
+ }
+
// admin socket helpers
void mirror_status(Formatter *f);
private:
+ bool is_blocklisted(const std::scoped_lock<ceph::mutex> &locker) const {
+ bool blocklisted = false;
+ if (m_instance_watcher) {
+ blocklisted = m_instance_watcher->is_blocklisted();
+ }
+ if (m_mirror_watcher) {
+ blocklisted |= m_mirror_watcher->is_blocklisted();
+ }
+
+ return blocklisted;
+ }
+
struct SnapListener : public InstanceWatcher::Listener {
FSMirror *fs_mirror;
}
void InstanceWatcher::handle_rewatch_complete(int r) {
- dout(20) << ": r=" << r << dendl;
+ dout(5) << ": r=" << r << dendl;
+
+ if (r == -EBLOCKLISTED) {
+ dout(0) << ": client blocklisted" <<dendl;
+ std::scoped_lock locker(m_lock);
+ m_blocklisted = true;
+ } else if (r == -ENOENT) {
+ derr << ": mirroring object deleted" << dendl;
+ } else if (r < 0) {
+ derr << ": rewatch error: " << cpp_strerror(r) << dendl;
+ }
}
void InstanceWatcher::create_instance() {
uint64_t notifier_id, bufferlist& bl) override;
void handle_rewatch_complete(int r) override;
+ bool is_blocklisted() {
+ std::scoped_lock locker(m_lock);
+ return m_blocklisted;
+ }
+
private:
librados::IoCtx &m_ioctx;
Listener &m_listener;
Context *m_on_init_finish = nullptr;
Context *m_on_shutdown_finish = nullptr;
+ bool m_blocklisted = false;
+
void create_instance();
void handle_create_instance(int r);
acknowledge_notify(notify_id, handle, outbl);
}
+void MirrorWatcher::handle_rewatch_complete(int r) {
+ dout(5) << ": r=" << r << dendl;
+
+ if (r == -EBLOCKLISTED) {
+ dout(0) << ": client blocklisted" <<dendl;
+ std::scoped_lock locker(m_lock);
+ m_blocklisted = true;
+ } else if (r == -ENOENT) {
+ derr << ": mirroring object deleted" << dendl;
+ } else if (r < 0) {
+ derr << ": rewatch error: " << cpp_strerror(r) << dendl;
+ }
+}
+
void MirrorWatcher::register_watcher() {
dout(20) << dendl;
void handle_notify(uint64_t notify_id, uint64_t handle,
uint64_t notifier_id, bufferlist& bl) override;
+ void handle_rewatch_complete(int r) override;
+
+ bool is_blocklisted() {
+ std::scoped_lock locker(m_lock);
+ return m_blocklisted;
+ }
private:
librados::IoCtx &m_ioctx;
Context *m_on_init_finish = nullptr;
Context *m_on_shutdown_finish = nullptr;
+ bool m_blocklisted = false;
+
void register_watcher();
void handle_register_watcher(int r);