From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55100) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsXjL-0008Ni-GC for qemu-devel@nongnu.org; Thu, 05 Jun 2014 09:29:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WsXjE-0008Gx-1q for qemu-devel@nongnu.org; Thu, 05 Jun 2014 09:29:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:6574) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsXjD-0008FI-OM for qemu-devel@nongnu.org; Thu, 05 Jun 2014 09:29:11 -0400 Date: Thu, 5 Jun 2014 15:29:06 +0200 From: Kevin Wolf Message-ID: <20140605132906.GC4885@noname.redhat.com> References: <1401801062-9154-1-git-send-email-kwolf@redhat.com> <1401801062-9154-16-git-send-email-kwolf@redhat.com> <20140603154348.GK21314@irqsave.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20140603154348.GK21314@irqsave.net> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v3 15/21] rbd: Handle failure for potentially large allocations List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?iso-8859-1?Q?Beno=EEt?= Canet Cc: mreitz@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, armbru@redhat.com Am 03.06.2014 um 17:43 hat Beno=EEt Canet geschrieben: > The Tuesday 03 Jun 2014 =E0 15:10:56 (+0200), Kevin Wolf wrote : > > Some code in the block layer makes potentially huge allocations. Fail= ure > > is not completely unexpected there, so avoid aborting qemu and handle > > out-of-memory situations gracefully. > >=20 > > This patch addresses the allocations in the rbd block driver. > >=20 > > Signed-off-by: Kevin Wolf > > Reviewed-by: Stefan Hajnoczi > > --- > > block/rbd.c | 7 +++++-- > > 1 file changed, 5 insertions(+), 2 deletions(-) > >=20 > > diff --git a/block/rbd.c b/block/rbd.c > > index 09af484..d0b2329 100644 > > --- a/block/rbd.c > > +++ b/block/rbd.c > > @@ -623,7 +623,7 @@ static BlockDriverAIOCB *rbd_start_aio(BlockDrive= rState *bs, > > RBDAIOCmd cmd) > > { > > RBDAIOCB *acb; > > - RADOSCB *rcb; > > + RADOSCB *rcb =3D NULL; > > rbd_completion_t c; > > int64_t off, size; > > char *buf; > > @@ -637,7 +637,10 @@ static BlockDriverAIOCB *rbd_start_aio(BlockDriv= erState *bs, > > if (cmd =3D=3D RBD_AIO_DISCARD || cmd =3D=3D RBD_AIO_FLUSH) { > > acb->bounce =3D NULL; > > } else { > > - acb->bounce =3D qemu_blockalign(bs, qiov->size); > > + acb->bounce =3D qemu_try_blockalign(bs, qiov->size); > I am under the impression that acb->bounce will be leaked in next goto = failed. Yes, I think you're right. That's a preexisting problem, though. I'll fix it in a patch independent from this series. Kevin