From 95b6a760b65edb0ca7238ef1fd4bc32cb08af8c2 Mon Sep 17 00:00:00 2001 From: Mykola Golub Date: Tue, 12 Mar 2019 18:22:25 +0000 Subject: [PATCH] rbd: wait for all io complete when bench is interrupted Signed-off-by: Mykola Golub --- src/tools/rbd/action/Bench.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tools/rbd/action/Bench.cc b/src/tools/rbd/action/Bench.cc index e08c3d3fb7b22..d96380782a9aa 100644 --- a/src/tools/rbd/action/Bench.cc +++ b/src/tools/rbd/action/Bench.cc @@ -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(); -- 2.39.5