From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47157) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XQzQu-0002hD-Fp for qemu-devel@nongnu.org; Mon, 08 Sep 2014 09:56:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XQzQi-0003wc-Dh for qemu-devel@nongnu.org; Mon, 08 Sep 2014 09:56:40 -0400 Received: from mx-v6.kamp.de ([2a02:248:0:51::16]:56912 helo=mx01.kamp.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XQzQi-0003wB-3D for qemu-devel@nongnu.org; Mon, 08 Sep 2014 09:56:28 -0400 Message-ID: <540DB583.4030101@kamp.de> Date: Mon, 08 Sep 2014 15:56:19 +0200 From: Peter Lieven MIME-Version: 1.0 References: <1409935888-18552-1-git-send-email-pl@kamp.de> <1409935888-18552-3-git-send-email-pl@kamp.de> <20140908134434.GB22582@irqsave.net> <540DB3E2.6010905@redhat.com> In-Reply-To: <540DB3E2.6010905@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH 2/4] block: immediately cancel oversized read/write requests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , =?windows-1252?Q?Beno=EEt_Cane?= =?windows-1252?Q?t?= Cc: kwolf@redhat.com, ronniesahlberg@gmail.com, qemu-devel@nongnu.org, stefanha@redhat.com, mreitz@redhat.com On 08.09.2014 15:49, Paolo Bonzini wrote: > Il 08/09/2014 15:44, Benoît Canet ha scritto: >>>> + if (bs->bl.max_transfer_length && nb_sectors > bs->bl.max_transfer_length) { >>>> + error_report("read of %d sectors at sector %ld exceeds device max" >>>> + " transfer length of %d sectors.", nb_sectors, sector_num, >>>> + bs->bl.max_transfer_length); >>>> + return -EINVAL; >>>> + } >>>> + >>>> return bdrv_co_do_preadv(bs, sector_num << BDRV_SECTOR_BITS, >>>> nb_sectors << BDRV_SECTOR_BITS, qiov, flags); >>>> } >>>> @@ -3507,6 +3514,13 @@ static int coroutine_fn bdrv_co_do_writev(BlockDriverState *bs, >>>> return -EINVAL; >>>> } >>>> >>>> + if (bs->bl.max_transfer_length && nb_sectors > bs->bl.max_transfer_length) { >>>> + error_report("write of %d sectors at sector %ld exceeds device max" >>>> + " transfer length of %d sectors.", nb_sectors, sector_num, >>>> + bs->bl.max_transfer_length); >>>> + return -EINVAL; >>>> + } >>>> + >>>> return bdrv_co_do_pwritev(bs, sector_num << BDRV_SECTOR_BITS, >>>> nb_sectors << BDRV_SECTOR_BITS, qiov, flags); >>>> } >>>> -- >>>> 1.7.9.5 >>>> >>>> >> Look like you are changing the coroutine version. >> >> Some hardware like virtio-blk uses the AIO version of read and writes. >> What would happen if all the block drivers down the chain are AIO enabled ? > The AIO version still goes through bdrv_co_do_readv/writev. > > However, error_report is not something you can use for guest-accessible > error messages, unless you want your logs to fill up with error messages. :) So you would not throw an error msg here? Peter