]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: possible deadlock if cluster connection closed after image
authorJason Dillaman <dillaman@redhat.com>
Fri, 9 Sep 2016 14:42:50 +0000 (10:42 -0400)
committerLoic Dachary <ldachary@redhat.com>
Thu, 13 Oct 2016 08:34:30 +0000 (10:34 +0200)
Fixes: http://tracker.ceph.com/issues/17254
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit 818c2f2abc972f689acb7d783c2a684bcc9e6e51)

src/librbd/ImageWatcher.cc

index 7aeb1c93489c8b65733cf1d190d96bbfc299be79..c828163b8adb47ddab716148f130a03d9ec4078e 100644 (file)
@@ -54,13 +54,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);
   }
 };