]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgwlc: lock_lambda overwrites ret val 47208/head
authorTongliang Deng <dengtongliang@gmail.com>
Thu, 21 Jul 2022 11:54:12 +0000 (11:54 +0000)
committerMatt Benjamin <mbenjamin@redhat.com>
Mon, 20 Nov 2023 13:54:02 +0000 (08:54 -0500)
`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 <dengtongliang@gmail.com>
src/rgw/rgw_lc.cc

index 978f9736b8ebf3bca0a93d54b3f72b5bcb68b92b..4ae3a950ade63069ed45a3f0383a9041e246fcef 100644 (file)
@@ -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;
   };