From 7bcb744d6b76aea3aebf065edfc231d6b5c42d2f Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Mon, 4 Jan 2016 12:54:33 -0800 Subject: [PATCH] Revert "rgw: use smart pointer for C_Reinitwatch" This commit introduced regressions, issues #14173, #14180. The problem is that the context deletes itself after execution, so using a shared_ptr to hold it is problematic, as we'll eventually have a double free. Also, it doesn't solve the underlying leak issue. This reverts commit e9daed221e7c6fd84aef78c3d5fc18470b916fcb. --- src/rgw/rgw_rados.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 982d7851ec98b..3e38e9effefe4 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -1305,7 +1305,6 @@ class RGWWatcher : public librados::WatchCtx2 { watcher->reinit(); } }; - shared_ptr reinit_watch; public: RGWWatcher(RGWRados *r, int i, const string& o) : rados(r), index(i), oid(o), watch_handle(0) {} void handle_notify(uint64_t notify_id, @@ -1326,8 +1325,7 @@ public: lderr(rados->ctx()) << "RGWWatcher::handle_error cookie " << cookie << " err " << cpp_strerror(err) << dendl; rados->remove_watcher(index); - reinit_watch.reset(new C_ReinitWatch(this)); - rados->schedule_context(reinit_watch.get()); + rados->schedule_context(new C_ReinitWatch(this)); } void reinit() { -- 2.39.5