From 4b043aa38023980ecc8345c62cfa26b6826a4dc0 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Mon, 5 Nov 2018 16:05:14 -0800 Subject: [PATCH] rgw: svc_notify: call set_enabled() when registering callback svc_notify starts before svc_sysobj_cache, this way we make sure svc_sysobj_cache gets the status callback triggered. Signed-off-by: Yehuda Sadeh --- src/rgw/services/svc_notify.cc | 4 +++- src/rgw/services/svc_notify.h | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/rgw/services/svc_notify.cc b/src/rgw/services/svc_notify.cc index 938b417c85f..2cbbdcb66ea 100644 --- a/src/rgw/services/svc_notify.cc +++ b/src/rgw/services/svc_notify.cc @@ -337,12 +337,13 @@ int RGWSI_Notify::watch_cb(uint64_t notify_id, void RGWSI_Notify::set_enabled(bool status) { - RWLock::RLocker l(watchers_lock); + RWLock::WLocker l(watchers_lock); _set_enabled(status); } void RGWSI_Notify::_set_enabled(bool status) { + enabled = status; if (cb) { cb->set_enabled(status); } @@ -459,6 +460,7 @@ void RGWSI_Notify::register_watch_cb(CB *_cb) { RWLock::WLocker l(watchers_lock); cb = _cb; + _set_enabled(enabled); } void RGWSI_Notify::schedule_context(Context *c) diff --git a/src/rgw/services/svc_notify.h b/src/rgw/services/svc_notify.h index 3dfbfd3e4ee..ca72c59e9ea 100644 --- a/src/rgw/services/svc_notify.h +++ b/src/rgw/services/svc_notify.h @@ -35,6 +35,8 @@ private: std::set watchers_set; vector notify_objs; + bool enabled{false}; + double inject_notify_timeout_probability{0}; unsigned max_notify_retries{0}; -- 2.39.5