From patchwork Thu Jun 12 08:15:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ma, Jianpeng" X-Patchwork-Id: 4339921 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B1DABBEEAA for ; Thu, 12 Jun 2014 08:15:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E7DAF202FF for ; Thu, 12 Jun 2014 08:15:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CB5FF202E9 for ; Thu, 12 Jun 2014 08:15:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755812AbaFLIP1 (ORCPT ); Thu, 12 Jun 2014 04:15:27 -0400 Received: from mga11.intel.com ([192.55.52.93]:11803 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752389AbaFLIPV convert rfc822-to-8bit (ORCPT ); Thu, 12 Jun 2014 04:15:21 -0400 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP; 12 Jun 2014 01:15:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="354030619" Received: from fmsmsx105.amr.corp.intel.com ([10.19.9.36]) by FMSMGA003.fm.intel.com with ESMTP; 12 Jun 2014 01:11:23 -0700 Received: from FMSMSX110.amr.corp.intel.com (10.18.116.10) by FMSMSX105.amr.corp.intel.com (10.19.9.36) with Microsoft SMTP Server (TLS) id 14.3.123.3; Thu, 12 Jun 2014 01:15:20 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx110.amr.corp.intel.com (10.18.116.10) with Microsoft SMTP Server (TLS) id 14.3.123.3; Thu, 12 Jun 2014 01:15:20 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.81]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.122]) with mapi id 14.03.0123.003; Thu, 12 Jun 2014 16:15:18 +0800 From: "Ma, Jianpeng" To: "ceph-devel@vger.kernel.org" Subject: [PATCH] rbd.cc: Check io-size avoid floating point exception. Thread-Topic: [PATCH] rbd.cc: Check io-size avoid floating point exception. Thread-Index: Ac+GFTPjvSSFuwt4R1SIg6Y5GmdQFw== Date: Thu, 12 Jun 2014 08:15:17 +0000 Message-ID: <6AA21C22F0A5DA478922644AD2EC308C87E2AA@SHSMSX101.ccr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In func do_bench_write if io_size is zero,it can cause floating point execption. Signed-off-by: Jianpeng Ma --- 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)) {