]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: fix crash while using advisory locks with R/O image 9882/head
authorJason Dillaman <dillaman@redhat.com>
Wed, 22 Jun 2016 22:19:52 +0000 (18:19 -0400)
committerJason Dillaman <dillaman@redhat.com>
Wed, 22 Jun 2016 22:19:52 +0000 (18:19 -0400)
Fixes: http://tracker.ceph.com/issues/16364
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/ImageCtx.cc
src/librbd/ImageWatcher.cc
src/librbd/ImageWatcher.h

index 564996985f9c63a10dc7edac464939d9befc63fd..87c710e9be4476015a7f6750e79a61a9c250bd23 100644 (file)
@@ -1019,10 +1019,7 @@ struct C_InvalidateCache : public Context {
 
   void ImageCtx::notify_update() {
     state->handle_update_notification();
-
-    C_SaferCond ctx;
-    image_watcher->notify_header_update(&ctx);
-    ctx.wait();
+    ImageWatcher::notify_header_update(md_ctx, header_oid);
   }
 
   void ImageCtx::notify_update(Context *on_finish) {
index 9cd643c68f3abc85b9116bf1c84ffa514a8deb48..9e18339c459d8ad304e192c786006f9e6b47b236 100644 (file)
@@ -321,6 +321,14 @@ void ImageWatcher::notify_header_update(Context *on_finish) {
   m_notifier.notify(bl, nullptr, on_finish);
 }
 
+void ImageWatcher::notify_header_update(librados::IoCtx &io_ctx,
+                                       const std::string &oid) {
+  // supports legacy (empty buffer) clients
+  bufferlist bl;
+  ::encode(NotifyMessage(HeaderUpdatePayload()), bl);
+  io_ctx.notify2(oid, bl, image_watcher::Notifier::NOTIFY_TIMEOUT, nullptr);
+}
+
 void ImageWatcher::schedule_cancel_async_requests() {
   FunctionContext *ctx = new FunctionContext(
     boost::bind(&ImageWatcher::cancel_async_requests, this));
index da1c11b332b5b4baff3c91e994897964c8ef804f..0ae5245a239084604ccf45013a649df3789546ed 100644 (file)
@@ -54,6 +54,8 @@ public:
   void notify_request_lock();
 
   void notify_header_update(Context *on_finish);
+  static void notify_header_update(librados::IoCtx &io_ctx,
+                                   const std::string &oid);
 
   uint64_t get_watch_handle() const {
     RWLock::RLocker watch_locker(m_watch_lock);