]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: clear realm watch on failed watch_restart 10660/head
authorCasey Bodley <cbodley@redhat.com>
Tue, 26 Jul 2016 16:50:13 +0000 (12:50 -0400)
committerLoic Dachary <ldachary@redhat.com>
Wed, 10 Aug 2016 12:19:52 +0000 (14:19 +0200)
if the realm is deleted while the gateway has a watch, it's disconnected
and watch_restart() will fail. this results in a watch handle of 0,
which leads to a segfault on ~RGWRealmWatcher when we pass it to
unwatch()

this commit cleans up the watch when watch_restart() fails, so we don't
try to unwatch() on destruction

Fixes: http://tracker.ceph.com/issues/16817
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit e5b8b5b27502fdacdac38effd7a55fd719911e85)

src/rgw/rgw_realm_watcher.cc

index d9383d6d31b5f24c7e51df2b8132f43b077503d5..0ed332c8655c5c515ed18a27ec89707f474dcfd9 100644 (file)
@@ -130,9 +130,12 @@ int RGWRealmWatcher::watch_restart()
         << " with " << cpp_strerror(-r) << dendl;
   }
   r = pool_ctx.watch2(watch_oid, &watch_handle, this);
-  if (r < 0)
+  if (r < 0) {
     lderr(cct) << "Failed to restart watch on " << watch_oid
         << " with " << cpp_strerror(-r) << dendl;
+    pool_ctx.close();
+    watch_oid.clear();
+  }
   return r;
 }