]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Avoid an extra read on the atomic variable
authorPavan Rallabhandi <pavan.rallabhandi@sandisk.com>
Wed, 29 Apr 2015 08:05:29 +0000 (13:35 +0530)
committerLoic Dachary <ldachary@redhat.com>
Sun, 30 Aug 2015 15:55:58 +0000 (17:55 +0200)
Signed-off-by: Pavan Rallabhandi <pavan.rallabhandi@sandisk.com>
(cherry picked from commit 7476e944af049aefdb8871cce62883b86f6b6f8d)

src/rgw/rgw_rados.cc

index 09664e9149ccf3dfad96647ce3548da284961cc0..a421efd31d70485cd330807bd2a06fcd41ee6a49 100644 (file)
@@ -8898,10 +8898,11 @@ librados::Rados* RGWRados::get_rados_handle()
     } else {
       handle_lock.put_read();
       handle_lock.get_write();
-      if (next_rados_handle.read() == num_rados_handles) {
+      uint32_t handle = next_rados_handle.read();
+      if (handle == num_rados_handles) {
         next_rados_handle.set(0);
+        handle = 0;
       }
-      int handle = next_rados_handle.read();
       rados_map[id] = handle;
       next_rados_handle.inc();
       handle_lock.put_write();