From patchwork Tue Jul 19 18:47:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 9238247 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 08DDB602F0 for ; Tue, 19 Jul 2016 20:09:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED7BB200F5 for ; Tue, 19 Jul 2016 20:09:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E058A200E7; Tue, 19 Jul 2016 20:09:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8061B200E7 for ; Tue, 19 Jul 2016 20:09:37 +0000 (UTC) Received: from localhost ([::1]:58309 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPax5-0004My-TA for patchwork-qemu-devel@patchwork.kernel.org; Tue, 19 Jul 2016 15:45:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45741) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPa4J-0002Xl-Bf for qemu-devel@nongnu.org; Tue, 19 Jul 2016 14:48:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPa4G-0005Y9-T2 for qemu-devel@nongnu.org; Tue, 19 Jul 2016 14:48:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55242) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPa4G-0005Xz-Nt for qemu-devel@nongnu.org; Tue, 19 Jul 2016 14:48:32 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4B8376438B; Tue, 19 Jul 2016 18:48:32 +0000 (UTC) Received: from localhost (ovpn-112-17.ams2.redhat.com [10.36.112.17]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6JImUpQ026618; Tue, 19 Jul 2016 14:48:31 -0400 From: Stefan Hajnoczi To: Date: Tue, 19 Jul 2016 19:47:56 +0100 Message-Id: <1468954095-5159-7-git-send-email-stefanha@redhat.com> In-Reply-To: <1468954095-5159-1-git-send-email-stefanha@redhat.com> References: <1468954095-5159-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 19 Jul 2016 18:48:32 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL for-2.7 06/25] iscsi: Rely on block layer to break up large requests X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Stefan Hajnoczi Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Blake Now that the block layer honors max_request, we don't need to bother with an EINVAL on overlarge requests, but can instead assert that requests are well-behaved. Signed-off-by: Eric Blake Reviewed-by: Fam Zheng Reviewed-by: Stefan Hajnoczi Acked-by: Paolo Bonzini Message-id: 1468607524-19021-7-git-send-email-eblake@redhat.com Signed-off-by: Stefan Hajnoczi --- block/iscsi.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/block/iscsi.c b/block/iscsi.c index cf1e9e7..bdc7ade 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -472,11 +472,8 @@ iscsi_co_writev_flags(BlockDriverState *bs, int64_t sector_num, int nb_sectors, return -EINVAL; } - if (bs->bl.max_transfer && - nb_sectors << BDRV_SECTOR_BITS > bs->bl.max_transfer) { - error_report("iSCSI Error: Write of %d sectors exceeds max_xfer_len " - "of %" PRIu32 " bytes", nb_sectors, bs->bl.max_transfer); - return -EINVAL; + if (bs->bl.max_transfer) { + assert(nb_sectors << BDRV_SECTOR_BITS <= bs->bl.max_transfer); } lba = sector_qemu2lun(sector_num, iscsilun); @@ -650,11 +647,8 @@ static int coroutine_fn iscsi_co_readv(BlockDriverState *bs, return -EINVAL; } - if (bs->bl.max_transfer && - nb_sectors << BDRV_SECTOR_BITS > bs->bl.max_transfer) { - error_report("iSCSI Error: Read of %d sectors exceeds max_xfer_len " - "of %" PRIu32 " bytes", nb_sectors, bs->bl.max_transfer); - return -EINVAL; + if (bs->bl.max_transfer) { + assert(nb_sectors << BDRV_SECTOR_BITS <= bs->bl.max_transfer); } if (iscsilun->lbprz && nb_sectors >= ISCSI_CHECKALLOC_THRES &&