From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37164) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKrrA-0000mN-Sc for qemu-devel@nongnu.org; Wed, 06 Jul 2016 14:47:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKrr9-0000Qu-0q for qemu-devel@nongnu.org; Wed, 06 Jul 2016 14:47:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58150) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKrr8-0000Qq-Rv for qemu-devel@nongnu.org; Wed, 06 Jul 2016 14:47:30 -0400 From: marcandre.lureau@redhat.com Date: Wed, 6 Jul 2016 20:46:57 +0200 Message-Id: <20160706184721.2007-5-marcandre.lureau@redhat.com> In-Reply-To: <20160706184721.2007-1-marcandre.lureau@redhat.com> References: <20160706184721.2007-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v3 04/28] vhost: make vhost_log_put() idempotent List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: mukawa@igel.co.jp, yuanhan.liu@linux.intel.com, victork@redhat.com, jonshin@cisco.com, mst@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= From: Marc-Andr=C3=A9 Lureau Clear dev->log* when calling vhost_log_put() Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/virtio/vhost.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index dbb4deb..2753bb4 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -362,6 +362,8 @@ static void vhost_log_put(struct vhost_dev *dev, bool= sync) if (!log) { return; } + dev->log =3D NULL; + dev->log_size =3D 0; =20 --log->refcnt; if (log->refcnt =3D=3D 0) { @@ -710,8 +712,6 @@ static int vhost_migration_log(MemoryListener *listen= er, int enable) return r; } vhost_log_put(dev, false); - dev->log =3D NULL; - dev->log_size =3D 0; } else { vhost_dev_log_resize(dev, vhost_get_log_size(dev)); r =3D vhost_dev_set_log(dev, true); @@ -1290,7 +1290,4 @@ void vhost_dev_stop(struct vhost_dev *hdev, VirtIOD= evice *vdev) =20 vhost_log_put(hdev, true); hdev->started =3D false; - hdev->log =3D NULL; - hdev->log_size =3D 0; } - --=20 2.9.0