From 0a361d59894ed68c4f9ba5b72176fd132e852639 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Sat, 16 Apr 2016 17:37:56 -0700 Subject: [PATCH] rgw: RGWRealmWatcher::watch_restart() also unwatches watch Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_realm_watcher.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_realm_watcher.cc b/src/rgw/rgw_realm_watcher.cc index 6e47c48460aff..d9383d6d31b5f 100644 --- a/src/rgw/rgw_realm_watcher.cc +++ b/src/rgw/rgw_realm_watcher.cc @@ -124,7 +124,12 @@ int RGWRealmWatcher::watch_start(RGWRealm& realm) int RGWRealmWatcher::watch_restart() { assert(!watch_oid.empty()); - int r = pool_ctx.watch2(watch_oid, &watch_handle, this); + int r = pool_ctx.unwatch2(watch_handle); + if (r < 0) { + lderr(cct) << "Failed to unwatch on " << watch_oid + << " with " << cpp_strerror(-r) << dendl; + } + r = pool_ctx.watch2(watch_oid, &watch_handle, this); if (r < 0) lderr(cct) << "Failed to restart watch on " << watch_oid << " with " << cpp_strerror(-r) << dendl; -- 2.39.5