#include "include/Context.h"
#include "common/errno.h"
-#include "rgw/rgw_cache.h"
+#include "rgw_cache.h"
#include "svc_notify.h"
#include "svc_finisher.h"
#include "svc_zone.h"
#include "svc_rados.h"
-#include "rgw/rgw_zone.h"
+#include "rgw_zone.h"
#define dout_subsys ceph_subsys_rgw
RGWSI_RADOS::Obj obj;
uint64_t watch_handle;
int register_ret{0};
+ bool unregister_done{false};
librados::AioCompletion *register_completion{nullptr};
class C_ReinitWatch : public Context {
}
void reinit() {
- int ret = unregister_watch();
- if (ret < 0) {
- ldout(cct, 0) << "ERROR: unregister_watch() returned ret=" << ret << dendl;
- return;
+ if(!unregister_done) {
+ int ret = unregister_watch();
+ if (ret < 0) {
+ ldout(cct, 0) << "ERROR: unregister_watch() returned ret=" << ret << dendl;
+ }
}
- ret = register_watch();
+ int ret = register_watch();
if (ret < 0) {
ldout(cct, 0) << "ERROR: register_watch() returned ret=" << ret << dendl;
+ svc->schedule_context(new C_ReinitWatch(this));
return;
}
}
int unregister_watch() {
int r = svc->unwatch(obj, watch_handle);
+ unregister_done = true;
if (r < 0) {
return r;
}
return r;
}
svc->add_watcher(index);
+ unregister_done = false;
return 0;
}
return r;
}
svc->add_watcher(index);
+ unregister_done = false;
return 0;
}
};