]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: reduce lock scope on copy-on-read IO path
authorJason Dillaman <dillaman@redhat.com>
Thu, 1 Mar 2018 22:57:17 +0000 (17:57 -0500)
committerJason Dillaman <dillaman@redhat.com>
Wed, 7 Mar 2018 17:45:42 +0000 (12:45 -0500)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/io/ObjectRequest.cc

index bc1d9e93fc3a7efb7c9e130530cf4ab10b0b66ff..320daedb25c667405d7a1f01382a4fdfb0ddcda6 100644 (file)
@@ -337,7 +337,7 @@ void ObjectReadRequest<I>::copyup() {
 
   ldout(image_ctx->cct, 20) << dendl;
 
-  Mutex::Locker copyup_locker(image_ctx->copyup_list_lock);
+  image_ctx->copyup_list_lock.Lock();
   auto it = image_ctx->copyup_list.find(this->m_object_no);
   if (it == image_ctx->copyup_list.end()) {
     // create and kick off a CopyupRequest
@@ -346,7 +346,10 @@ void ObjectReadRequest<I>::copyup() {
       this->m_trace);
 
     image_ctx->copyup_list[this->m_object_no] = new_req;
+    image_ctx->copyup_list_lock.Unlock();
     new_req->send();
+  } else {
+    image_ctx->copyup_list_lock.Unlock();
   }
 
   image_ctx->parent_lock.put_read();