]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: possible deadlock if cluster connection closed after image 11037/head
authorJason Dillaman <dillaman@redhat.com>
Fri, 9 Sep 2016 14:42:50 +0000 (10:42 -0400)
committerJason Dillaman <dillaman@redhat.com>
Sat, 10 Sep 2016 17:43:02 +0000 (13:43 -0400)
Fixes: http://tracker.ceph.com/issues/17254
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/ImageWatcher.cc

index 019130c32ad465e8944ae388b3230e3cb3bc9ca8..a534ae08a80b4939d59c9a4470ecd1d3c24cc716 100644 (file)
@@ -55,13 +55,19 @@ struct C_UnwatchAndFlush : public Context {
       r = rados.aio_watch_flush(aio_comp);
       assert(r == 0);
       aio_comp->release();
-    } else {
-      Context::complete(ret_val);
+      return;
     }
+
+    // ensure our reference to the RadosClient is released prior
+    // to completing the callback to avoid racing an explicit
+    // librados shutdown
+    Context *ctx = on_finish;
+    delete this;
+
+    ctx->complete(ret_val);
   }
 
   virtual void finish(int r) override {
-    on_finish->complete(r);
   }
 };