summaryrefslogtreecommitdiff
path: root/blockdev.c
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2013-06-05 10:33:14 +0200
committerStefan Hajnoczi <stefanha@redhat.com>2013-06-05 16:39:59 +0200
commit293c51a6ee369228633a8428ab689f14c045ff98 (patch)
treebb75da081a3a01c5327cc0e95ae7f824a533186c /blockdev.c
parent8819c10b5d55d537d59a0ffd5d623f348fc36c47 (diff)
downloadqemu-293c51a6ee369228633a8428ab689f14c045ff98.tar.gz
blockdev: reset werror/rerror on drive_del
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. The guest is stuck in a continuous pause loop since the I/O request is retried and fails immediately again when the guest is resumed. With this patch the error is reported to the guest. 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> Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'blockdev.c')
-rw-r--r--blockdev.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/blockdev.c b/blockdev.c
index b9b2d10e6b..9937311aac 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));
}