]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: limit --io-size to avoid divide by zero in do_bench
authorYunchuan Wen <yunchuan.wen@kylin-cloud.com>
Wed, 28 Dec 2016 09:19:54 +0000 (17:19 +0800)
committerYunchuan Wen <yunchuan.wen@kylin-cloud.com>
Wed, 28 Dec 2016 09:33:22 +0000 (17:33 +0800)
Signed-off-by: Yunchuan Wen <yunchuan.wen@kylin-cloud.com>
src/tools/rbd/action/Bench.cc

index fae1db45ec3da19794a58a7657544dea8803898d..413226b3406ca9a77af7fb640a88aa4050da77cd 100644 (file)
@@ -350,6 +350,10 @@ int bench_execute(const po::variables_map &vm, io_type_t bench_io_type) {
   } else {
     bench_io_size = 4096;
   }
+  if (bench_io_size == 0) {
+    std::cerr << "rbd: --io-size should be greater than zero." << std::endl;
+    return -EINVAL;
+  }
 
   uint32_t bench_io_threads;
   if (vm.count("io-threads")) {