From c094f1a90954058a70255099ea8b877fd49db1ff Mon Sep 17 00:00:00 2001 From: Tongliang Deng Date: Thu, 21 Jul 2022 11:54:12 +0000 Subject: [PATCH] rgwlc: lock_lambda overwrites ret val `lock_lambda` captures `ret` by reference, it will overwrites returned value of `bucket_lc_process` when `wait_backoff` is called. Fixes: c069eb7ff09b52003fa00a5cc83b1e52370032f5. Signed-off-by: Tongliang Deng --- src/rgw/rgw_lc.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rgw/rgw_lc.cc b/src/rgw/rgw_lc.cc index 978f9736b8ebf..4ae3a950ade63 100644 --- a/src/rgw/rgw_lc.cc +++ b/src/rgw/rgw_lc.cc @@ -2133,14 +2133,14 @@ int RGWLC::process(int index, int max_lock_secs, LCWorker* worker, utime_t lock_for_s(max_lock_secs, 0); const auto& lock_lambda = [&]() { - ret = lock->try_lock(this, lock_for_s, null_yield); + int ret = lock->try_lock(this, lock_for_s, null_yield); if (ret == 0) { return true; } if (ret == -EBUSY || ret == -EEXIST) { /* already locked by another lc processor */ return false; - } + } return false; }; -- 2.47.3