]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
hammer: tools: fix race condition in seq/rand bench (part 2) 7817/head
authorAlexey Sheplyakov <asheplyakov@mirantis.com>
Fri, 26 Feb 2016 12:01:11 +0000 (15:01 +0300)
committerAlexey Sheplyakov <asheplyakov@mirantis.com>
Thu, 3 Mar 2016 12:36:13 +0000 (15:36 +0300)
Commit c2c6d02591519dfd15ddcb397ac440322a964deb which is intended to
cherry-pick 9bcf5f065c4ed4b10d8f98961d1f99493bcdc9b8 incorrectly resolved
a conflict by adding code where it should have been removed. The incorrect
conflict resolution can been displayed with

   commit=c2c6d02591519dfd15ddcb397ac440322a964deb
   picked_from=9bcf5f065c4ed4b10d8f98961d1f99493bcdc9b8
   diff -u --ignore-matching-lines '^[^+-]' <(git show $picked_from) <(git show $commit)

--- /dev/fd/63    2016-03-03 14:09:51.354329129 +0700
+++ /dev/fd/62    2016-03-03 14:09:51.358329122 +0700
@@ -76,20 +79,18 @@
      ++data.in_flight;
 -    if (!no_verify) {
 -      snprintf(data.object_contents, data.object_size, "I'm the %16dth object!", current_index);
--      lock.Unlock();
+       lock.Unlock();
 -      if (memcmp(data.object_contents, cur_contents->c_str(), data.object_size) != 0) {
 -        cerr << name[slot] << " is not correct!" << std::endl;
 -        ++errors;
 -      }
--    } else {
--        lock.Unlock();
--    }
--
-+    lock.Unlock();
-     name[slot] = newName;
-   }
-
-@@ -789,11 +791,14 @@ int ObjBencher::rand_read_bench(int seconds_to_run, int num_objects, int concurr
++    if (memcmp(data.object_contents, cur_contents->c_str(), data.object_size) != 0) {
++      cerr << name[slot] << " is not correct!" << std::endl;
++      ++errors;
+     } else {
+       lock.Unlock();
+     }
+@@ -776,11 +785,14 @@ int ObjBencher::rand_read_bench(int seconds_to_run, int num_objects, int concurr
        }
        lc.cond.Wait(lock);
      }

http://tracker.ceph.com/issues/14873 Fixes: #14873

Signed-off-by: Alexey Sheplyakov <asheplyakov@mirantis.com>
src/common/obj_bencher.cc

index db4fd8f8c73a86ea23817e3faa770d76a7c23805..000e4330e670254479b3e8fa00f3d508d625f814 100644 (file)
@@ -624,14 +624,7 @@ int ObjBencher::seq_read_bench(int seconds_to_run, int num_objects, int concurre
     lock.Lock();
     ++data.started;
     ++data.in_flight;
-      lock.Unlock();
-    if (memcmp(data.object_contents, cur_contents->c_str(), data.object_size) != 0) {
-      cerr << name[slot] << " is not correct!" << std::endl;
-      ++errors;
-    } else {
-      lock.Unlock();
-    }
-
+    lock.Unlock();
     name[slot] = newName;
   }