From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55536) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WBTHB-0003hO-LZ for qemu-devel@nongnu.org; Thu, 06 Feb 2014 13:02:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WBTH5-0002yJ-C2 for qemu-devel@nongnu.org; Thu, 06 Feb 2014 13:02:13 -0500 Received: from cantor2.suse.de ([195.135.220.15]:39396 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WBTH5-0002yE-6d for qemu-devel@nongnu.org; Thu, 06 Feb 2014 13:02:07 -0500 Message-ID: <52F3CE1A.8050709@suse.de> Date: Thu, 06 Feb 2014 19:02:02 +0100 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1391702153-19893-1-git-send-email-olaf@aepfle.de> In-Reply-To: <1391702153-19893-1-git-send-email-olaf@aepfle.de> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] xen_disk: fix io accounting List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Olaf Hering , qemu-devel@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com, stefano.stabellini@eu.citrix.com Am 06.02.2014 16:55, schrieb Olaf Hering: > bdrv_acct_done was called unconditional. But in case the ioreq has no > segments there is no matching bdrv_acct_start call. This could lead to > bogus accounting values. >=20 > Found by code inspection. >=20 > Signed-off-by: Olaf Hering > --- > hw/block/xen_disk.c | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) >=20 > diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c > index 098f6c6..7f0f14a 100644 > --- a/hw/block/xen_disk.c > +++ b/hw/block/xen_disk.c > @@ -483,7 +483,18 @@ static void qemu_aio_complete(void *opaque, int re= t) > ioreq->status =3D ioreq->aio_errors ? BLKIF_RSP_ERROR : BLKIF_RSP_= OKAY; > ioreq_unmap(ioreq); > ioreq_finish(ioreq); > - bdrv_acct_done(ioreq->blkdev->bs, &ioreq->acct); > + switch (ioreq->req.operation) { > + case BLKIF_OP_WRITE: > + case BLKIF_OP_FLUSH_DISKCACHE: > + if (!ioreq->req.nr_segments) { > + break; > + } This will need a /* fall through */ comment for static analysis tools. Andreas > + case BLKIF_OP_READ: > + bdrv_acct_done(ioreq->blkdev->bs, &ioreq->acct); > + break; > + default: > + break; > + } > qemu_bh_schedule(ioreq->blkdev->bh); > } > =20 >=20 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg