]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: complete cache reads on cache's dedicate thread 8011/head
authorJason Dillaman <dillaman@redhat.com>
Wed, 9 Mar 2016 23:00:04 +0000 (18:00 -0500)
committerJason Dillaman <dillaman@redhat.com>
Wed, 9 Mar 2016 23:12:11 +0000 (18:12 -0500)
If a snapshot is created out-of-band, the next IO will result in the
cache being flushed.  If pending writeback data performs a copy-on-write,
the read from the parent will be blocked.

Fixes: #15032
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit f9e5ae80e3b0799b5a7e1d3f93b2d85a4baff20f)

src/librbd/AioCompletion.cc
src/librbd/LibrbdWriteback.cc
src/librbd/LibrbdWriteback.h

index 6222531bedac9ab669b45e6de6b7cab81e55fddf..efbc84945ffbf25c57d837ce3ddc11692b97c9dd 100644 (file)
@@ -177,9 +177,10 @@ namespace librbd {
   void C_CacheRead::complete(int r) {
     if (!m_enqueued) {
       // cache_lock creates a lock ordering issue -- so re-execute this context
-      // outside the cache_lock
+      // outside the cache_lock. use the writeback handler's dedicated thread
+      // to avoid blocking a dependent operation
       m_enqueued = true;
-      m_image_ctx.op_work_queue->queue(this, r);
+      m_image_ctx.writeback_handler->queue(this, r);
       return;
     }
     Context::complete(r);
index ac778eec5455daec3f54eabd86131aadae52e5da..ee14f001dbd5c28ca0a7aa812c169b5efee6fff0 100644 (file)
@@ -102,6 +102,10 @@ namespace librbd {
     delete m_finisher;
   }
 
+  void LibrbdWriteback::queue(Context *ctx, int r) {
+    m_finisher->queue(ctx, r);
+  }
+
   void LibrbdWriteback::read(const object_t& oid, uint64_t object_no,
                             const object_locator_t& oloc,
                             uint64_t off, uint64_t len, snapid_t snapid,
@@ -114,7 +118,7 @@ namespace librbd {
 
     {
       if (!m_ictx->object_map.object_may_exist(object_no)) {
-       m_finisher->queue(req, -ENOENT);
+       queue(req, -ENOENT);
        return;
       }
     }
index b5578ae62f5c3e92718639ec8aa4eb0a09b4d1c8..5b65504c83da3e8a49157a43e1826908717642be 100644 (file)
@@ -23,6 +23,8 @@ namespace librbd {
     LibrbdWriteback(ImageCtx *ictx, Mutex& lock);
     virtual ~LibrbdWriteback();
 
+    void queue(Context *ctx, int r);
+
     // Note that oloc, trunc_size, and trunc_seq are ignored
     virtual void read(const object_t& oid, uint64_t object_no,
                      const object_locator_t& oloc, uint64_t off, uint64_t len,