Received: from eggs.gnu.org ([2001:4830:134:3::10]:48048) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X42DD-0001Pt-Hr for qemu-devel@nongnu.org; Mon, 07 Jul 2014 02:15:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X42D7-0002Ok-NV for qemu-devel@nongnu.org; Mon, 07 Jul 2014 02:15:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:8712) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X42D7-0002OK-GD for qemu-devel@nongnu.org; Mon, 07 Jul 2014 02:15:33 -0400 Date: Mon, 7 Jul 2014 14:15:41 +0800 From: Fam Zheng Message-ID: <20140707061541.GF1119@T430.redhat.com> References: <1404533935-12365-1-git-send-email-ming.lei@canonical.com> <1404533935-12365-2-git-send-email-ming.lei@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1404533935-12365-2-git-send-email-ming.lei@canonical.com> Subject: Re: [Qemu-devel] [PATCH v1 1/2] virtio-blk: data-plane: fix save/set .complete_request in start List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Ming Lei Cc: Kevin Wolf , Peter Maydell , "Michael S. Tsirkin" , qemu-devel@nongnu.org, Stefan Hajnoczi , Paolo Bonzini On Sat, 07/05 12:18, Ming Lei wrote: > The callback has to be saved and reset in virtio_blk_data_plane_start(), > otherwise dataplane's requests will be completed in qemu aio context. Yes, the cb is wrong once virtio_blk_data_plane_stop is called (device reset, etc.). Reviewed-by: Fam Zheng > > Signed-off-by: Ming Lei > --- > hw/block/dataplane/virtio-blk.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c > index 227bb15..e88862d 100644 > --- a/hw/block/dataplane/virtio-blk.c > +++ b/hw/block/dataplane/virtio-blk.c > @@ -125,7 +125,6 @@ void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *blk, > Error **errp) > { > VirtIOBlockDataPlane *s; > - VirtIOBlock *vblk = VIRTIO_BLK(vdev); > Error *local_err = NULL; > BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev))); > VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); > @@ -178,8 +177,6 @@ void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *blk, > bdrv_op_block_all(blk->conf.bs, s->blocker); > > *dataplane = s; > - s->saved_complete_request = vblk->complete_request; > - vblk->complete_request = complete_request_vring; > } > > /* Context: QEMU global mutex held */ > @@ -201,6 +198,7 @@ void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s) > { > BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(s->vdev))); > VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); > + VirtIOBlock *vblk = VIRTIO_BLK(s->vdev); > VirtQueue *vq; > > if (s->started) { > @@ -234,6 +232,9 @@ void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s) > } > s->host_notifier = *virtio_queue_get_host_notifier(vq); > > + s->saved_complete_request = vblk->complete_request; > + vblk->complete_request = complete_request_vring; > + > s->starting = false; > s->started = true; > trace_virtio_blk_data_plane_start(s); > -- > 1.7.9.5 > >