From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45730) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XQzKC-0000P1-4i for qemu-devel@nongnu.org; Mon, 08 Sep 2014 09:49:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XQzK5-0001zB-Um for qemu-devel@nongnu.org; Mon, 08 Sep 2014 09:49:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:19743) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XQzK5-0001yA-NW for qemu-devel@nongnu.org; Mon, 08 Sep 2014 09:49:37 -0400 Message-ID: <540DB3E2.6010905@redhat.com> Date: Mon, 08 Sep 2014 15:49:22 +0200 From: Paolo Bonzini 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> In-Reply-To: <20140908134434.GB22582@irqsave.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable 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: =?windows-1252?Q?Beno=EEt_Canet?= , Peter Lieven Cc: kwolf@redhat.com, ronniesahlberg@gmail.com, qemu-devel@nongnu.org, stefanha@redhat.com, mreitz@redhat.com Il 08/09/2014 15:44, Beno=EEt Canet ha scritto: >> > + if (bs->bl.max_transfer_length && nb_sectors > bs->bl.max_trans= fer_length) { >> > + error_report("read of %d sectors at sector %ld exceeds devi= ce 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(Blo= ckDriverState *bs, >> > return -EINVAL; >> > } >> > =20 >> > + if (bs->bl.max_transfer_length && nb_sectors > bs->bl.max_trans= fer_length) { >> > + error_report("write of %d sectors at sector %ld exceeds dev= ice 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); >> > } >> > --=20 >> > 1.7.9.5 >> >=20 >> >=20 > Look like you are changing the coroutine version. >=20 > 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 enabl= ed ? 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.= :) Paolo