From: Ilsoo Byun Date: Mon, 7 Oct 2019 08:18:19 +0000 (+0900) Subject: rgw: protect AioResultList by AioThrottle::mutex to avoid race condition X-Git-Tag: v14.2.5~111^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=375f1a5b59e14f5d6397f1ce2be049180943ca96;p=ceph.git 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 --- diff --git a/src/rgw/rgw_aio_throttle.cc b/src/rgw/rgw_aio_throttle.cc index 1ac1be259d3..79d095d20f4 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); }