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 <jianpeng.ma@intel.com>
This commit is contained in:
Jianpeng Ma 2016-06-13 22:10:52 +08:00
parent eac6b844d9
commit c326702bfd
2 changed files with 13 additions and 0 deletions

View 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;

View File

@ -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 "$@"