From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51730) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjWg7-0001gD-E3 for qemu-devel@nongnu.org; Mon, 03 Jun 2013 11:28:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UjWg2-0003I3-Nr for qemu-devel@nongnu.org; Mon, 03 Jun 2013 11:28:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:13774) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjWYb-0000Zr-3Y for qemu-devel@nongnu.org; Mon, 03 Jun 2013 11:20:25 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r53FKOFa029506 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 3 Jun 2013 11:20:24 -0400 Message-ID: <51ACB428.6070301@redhat.com> Date: Mon, 03 Jun 2013 17:20:08 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1370271492-5259-1-git-send-email-stefanha@redhat.com> In-Reply-To: <1370271492-5259-1-git-send-email-stefanha@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] blockdev: reset werror/rerror on drive_del List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , dron@redhat.com, qemu-devel@nongnu.org, Markus Armbruster Il 03/06/2013 16:58, Stefan Hajnoczi ha scritto: > Paolo Bonzini suggested the following test case: > > 1. Launch a guest and wait at the GRUB boot menu: > > qemu-system-x86_64 -enable-kvm -m 1024 \ > -drive if=none,cache=none,file=test.img,id=foo,werror=stop,rerror=stop > -device virtio-blk-pci,drive=foo,id=virtio0,addr=4 > > 2. Hot unplug the device: > > (qemu) drive_del foo > > 3. Select the first boot menu entry > > Without this patch the guest pauses due to ENOMEDIUM. But it is not > possible to resolve this situation - the drive has become anonymous. > > With this patch the guest the guest gets the ENOMEDIUM error. > > Note that this scenario actually happens sometimes during libvirt disk > hot unplug, where device_del is followed by drive_del. I/O may still be > submitted to the drive after drive_del if the guest does not process the > PCI hot unplug notification. > > Reported-by: Dafna Ron > Signed-off-by: Stefan Hajnoczi > --- > blockdev.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/blockdev.c b/blockdev.c > index d1ec99a..6eb81a3 100644 > --- a/blockdev.c > +++ b/blockdev.c > @@ -1180,6 +1180,10 @@ int do_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data) > */ > if (bdrv_get_attached_dev(bs)) { > bdrv_make_anon(bs); > + > + /* Further I/O must not pause the guest */ > + bdrv_set_on_error(bs, BLOCKDEV_ON_ERROR_REPORT, > + BLOCKDEV_ON_ERROR_REPORT); > } else { > drive_uninit(drive_get_by_blockdev(bs)); > } > Reviewed-by: Paolo Bonzini Paolo