]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: protect AioResultList by AioThrottle::mutex to avoid race condition 30746/head
authorIlsoo Byun <ilsoobyun@linecorp.com>
Mon, 7 Oct 2019 08:18:19 +0000 (17:18 +0900)
committerIlsoo Byun <ilsoobyun@linecorp.com>
Thu, 10 Oct 2019 15:30:32 +0000 (00:30 +0900)
This change is not cherry-picked from master because, in master,
the BlockingAioThrottle does cover these cases with a lock.

Fixes: https://tracker.ceph.com/issues/39660
Signed-off-by: Ilsoo Byun <ilsoobyun@linecorp.com>
src/rgw/rgw_aio_throttle.cc

index 1ac1be259d3ee1c455442407b87671ca9e292efa..79d095d20f456c4865b58a6ecd363ea7df7b1db2 100644 (file)
@@ -48,6 +48,7 @@ AioResultList AioThrottle::submit(RGWSI_RADOS::Obj& obj,
 
   if (cost > window) {
     p->result = -EDEADLK; // would never succeed
+    std::unique_lock lock{mutex};
     completed.push_back(*p);
   } else {
     get(*p);
@@ -57,6 +58,7 @@ AioResultList AioThrottle::submit(RGWSI_RADOS::Obj& obj,
     }
   }
   p.release();
+  std::unique_lock lock{mutex};
   return std::move(completed);
 }
 
@@ -71,6 +73,7 @@ AioResultList AioThrottle::submit(RGWSI_RADOS::Obj& obj,
 
   if (cost > window) {
     p->result = -EDEADLK; // would never succeed
+    std::unique_lock lock{mutex};
     completed.push_back(*p);
   } else {
     get(*p);
@@ -80,6 +83,7 @@ AioResultList AioThrottle::submit(RGWSI_RADOS::Obj& obj,
     }
   }
   p.release();
+  std::unique_lock lock{mutex};
   return std::move(completed);
 }