]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: wait for all io complete when bench is interrupted 26918/head
authorMykola Golub <mgolub@suse.com>
Tue, 12 Mar 2019 18:22:25 +0000 (18:22 +0000)
committerMykola Golub <mgolub@suse.com>
Tue, 12 Mar 2019 18:24:19 +0000 (18:24 +0000)
Signed-off-by: Mykola Golub <mgolub@suse.com>
src/tools/rbd/action/Bench.cc

index e08c3d3fb7b22e38a4e5309526a2c5067bcd8936..d96380782a9aa8217ef0c3cbab81095be6b3c427 100644 (file)
@@ -157,9 +157,9 @@ struct rbd_bencher {
     }
   }
 
-  int wait_for(int max) {
+  int wait_for(int max, bool interrupt_on_terminating) {
     Mutex::Locker l(lock);
-    while (in_flight > max && !terminating) {
+    while (in_flight > max && !(terminating && interrupt_on_terminating)) {
       utime_t dur;
       dur.set_from_double(.2);
       cond.WaitInterval(lock, dur);
@@ -292,7 +292,7 @@ int do_bench(librbd::Image& image, io_type_t io_type,
     while (i < io_threads && off < io_bytes) {
       bool read_flag = should_read(read_proportion);
 
-      r = b.wait_for(io_threads - 1);
+      r = b.wait_for(io_threads - 1, true);
       if (r < 0) {
         break;
       }
@@ -351,7 +351,7 @@ int do_bench(librbd::Image& image, io_type_t io_type,
       last = elapsed;
     }
   }
-  b.wait_for(0);
+  b.wait_for(0, false);
 
   if (io_type != IO_TYPE_READ) {
     r = image.flush();