From: Jianpeng Ma Date: Mon, 13 Jun 2016 14:10:52 +0000 (+0800) Subject: osd/OSD: fix Floating point exception. X-Git-Tag: v11.0.0~143^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c326702bfd633b5fe9c34aac85f54678407c24fe;p=ceph.git osd/OSD: fix Floating point exception. When do 'ceph tell osd.x bench', if block_size is larger than object_size, it will cause Floating point exception. For this case, set block_size = object_size(expect object_size = 0). Also add related test-case. Signed-off-by: Jianpeng Ma --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index c40cb6f0796..c84c2098fd0 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -5586,6 +5586,9 @@ void OSD::do_command(Connection *con, ceph_tid_t tid, vector& cmd, buffe } } + if (osize && bsize > osize) + bsize = osize; + dout(1) << " bench count " << count << " bsize " << prettybyte_t(bsize) << dendl; diff --git a/src/test/osd/osd-bench.sh b/src/test/osd/osd-bench.sh index ac40cb0d8cd..f14a35152f7 100755 --- a/src/test/osd/osd-bench.sh +++ b/src/test/osd/osd-bench.sh @@ -77,6 +77,16 @@ function TEST_bench() { # default values should work # ceph tell osd.0 bench || return 1 + + # + # test object_size < block_size + ceph tell osd.0 bench 10 14456 4444 3 + # + + # + # test object_size < block_size & object_size = 0(default value) + # + ceph tell osd.0 bench 1 14456 } main osd-bench "$@"