From 375f1a5b59e14f5d6397f1ce2be049180943ca96 Mon Sep 17 00:00:00 2001 From: Ilsoo Byun Date: Mon, 7 Oct 2019 17:18:19 +0900 Subject: [PATCH] rgw: protect AioResultList by AioThrottle::mutex to avoid race condition 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 --- src/rgw/rgw_aio_throttle.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/rgw/rgw_aio_throttle.cc b/src/rgw/rgw_aio_throttle.cc index 1ac1be259d3e..79d095d20f45 100644 --- a/src/rgw/rgw_aio_throttle.cc +++ b/src/rgw/rgw_aio_throttle.cc @@ -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); } -- 2.47.3