[PATCH] rbd.cc: Check io-size avoid floating point exception.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In func do_bench_write if io_size is zero,it can cause floating point execption.

Signed-off-by: Jianpeng Ma <jianpeng.ma@xxxxxxxxx>
---
 src/rbd.cc | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/rbd.cc b/src/rbd.cc
index d6658e3..c068ed6 100644
--- a/src/rbd.cc
+++ b/src/rbd.cc
@@ -2038,6 +2038,14 @@ int main(int argc, const char **argv)
 	return EXIT_FAILURE;
       }
     } else if (ceph_argparse_withlonglong(args, i, &bench_io_size, &err, "--io-size", (char*)NULL)) {
+      if (!err.str().empty()) {
+	cerr << "rbd: " << err.str() << std::endl;
+	return EXIT_FAILURE;
+      }
+      if (bench_io_size == 0) {
+	cerr << "rbd: io-size must be > 0" << std::endl;
+	return EXIT_FAILURE;
+      }
     } else if (ceph_argparse_withlonglong(args, i, &bench_io_threads, &err, "--io-threads", (char*)NULL)) {
     } else if (ceph_argparse_withlonglong(args, i, &bench_bytes, &err, "--io-total", (char*)NULL)) {
     } else if (ceph_argparse_witharg(args, i, &bench_pattern, &err, "--io-pattern", (char*)NULL)) {
-- 
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux