]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/OSD: fix Floating point exception. 8827/head
authorJianpeng Ma <jianpeng.ma@intel.com>
Mon, 13 Jun 2016 14:10:52 +0000 (22:10 +0800)
committerJianpeng Ma <jianpeng.ma@intel.com>
Mon, 13 Jun 2016 14:10:52 +0000 (22:10 +0800)
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 <jianpeng.ma@intel.com>
src/osd/OSD.cc
src/test/osd/osd-bench.sh

index c40cb6f07968e688daaeba72bcfae5a2e6ddd6cd..c84c2098fd02bd7e1f6f5099986181b6038296f4 100644 (file)
@@ -5586,6 +5586,9 @@ void OSD::do_command(Connection *con, ceph_tid_t tid, vector<string>& cmd, buffe
       }
     }
 
+    if (osize && bsize > osize)
+      bsize = osize;
+
     dout(1) << " bench count " << count
             << " bsize " << prettybyte_t(bsize) << dendl;
 
index ac40cb0d8cd3208b6afd30a40d6e782848398644..f14a35152f7d4542cf3b6590b8f3f08b247a58b9 100755 (executable)
@@ -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 "$@"