qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] blockdev: reset werror/rerror on drive_del
@ 2013-06-03 14:58 Stefan Hajnoczi
  2013-06-03 15:20 ` Paolo Bonzini
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Stefan Hajnoczi @ 2013-06-03 14:58 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, dron, Markus Armbruster, Stefan Hajnoczi,
	Paolo Bonzini

Paolo Bonzini <pbonzini@redhat.com> 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 <dron@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 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));
     }
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-06-05  8:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-03 14:58 [Qemu-devel] [PATCH] blockdev: reset werror/rerror on drive_del Stefan Hajnoczi
2013-06-03 15:20 ` Paolo Bonzini
2013-06-04 16:37 ` Markus Armbruster
2013-06-04 17:04   ` Paolo Bonzini
2013-06-04 19:24     ` Markus Armbruster
2013-06-04 19:32       ` Eric Blake
2013-06-05  7:09         ` Markus Armbruster
2013-06-05  8:21   ` Stefan Hajnoczi
2013-06-05  8:26 ` Fam Zheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).