From: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
To: rusty@rustcorp.com.au, mst@redhat.com,
virtualization@lists.linux-foundation.org
Cc: borntraeger@de.ibm.com
Subject: [PATCH RFC 7/7] virtio_blk: trigger IO errors in case virtqueue is broken
Date: Tue, 22 Oct 2013 14:45:11 +0200 [thread overview]
Message-ID: <1382445911-55657-8-git-send-email-graalfs@linux.vnet.ibm.com> (raw)
In-Reply-To: <1382445911-55657-1-git-send-email-graalfs@linux.vnet.ibm.com>
In case the virtqueue is flagged as broken, IO errors are triggered
for current request queue entries.
Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
---
drivers/block/virtio_blk.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 01b5d3a..8eb91be 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -875,6 +875,20 @@ out:
return err;
}
+static void virtblk_flush_request_queue(struct request_queue *q)
+{
+ spinlock_t *lock = q->queue_lock;
+ struct request *req;
+
+ if (!q)
+ return;
+
+ spin_lock_irq(lock);
+ while ((req = blk_fetch_request(q)))
+ __blk_end_request_all(req, -EIO);
+ spin_unlock_irq(lock);
+}
+
static void virtblk_remove(struct virtio_device *vdev)
{
struct virtio_blk *vblk = vdev->priv;
@@ -890,6 +904,7 @@ static void virtblk_remove(struct virtio_device *vdev)
virtqueue_notify(vblk->vq);
if (virtqueue_is_broken(vblk->vq)) {
queue_broken = true;
+ virtblk_flush_request_queue(vblk->disk->queue);
blk_cleanup_queue(vblk->disk->queue);
del_gendisk(vblk->disk);
} else {
--
1.8.3.1
prev parent reply other threads:[~2013-10-22 12:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-22 12:45 [PATCH RFC 0/7] virtio: avoid various hang situations during hot-unplug Heinz Graalfs
2013-10-22 12:45 ` [PATCH RFC 1/7] virtio_ring: add new functions virtqueue{_set_broken()/_is_broken()} Heinz Graalfs
2013-10-23 0:06 ` Rusty Russell
2013-10-22 12:45 ` [PATCH RFC 2/7] s390/virtio_ccw: set virtqueue as broken if host notify failed Heinz Graalfs
2013-10-22 12:45 ` [PATCH RFC 3/7] virtio_net: avoid cpu_relax() call loop in case virtqueue is broken Heinz Graalfs
2013-10-22 12:45 ` [PATCH RFC 4/7] virtio_blk: use dummy virtqueue_notify() to detect host kick error Heinz Graalfs
2013-10-23 0:02 ` Rusty Russell
2013-10-22 12:45 ` [PATCH RFC 5/7] virtio_blk: do not free device id if virtqueue is broken Heinz Graalfs
2013-10-22 12:45 ` [PATCH RFC 6/7] virtio_blk: set request queue as dying in case " Heinz Graalfs
2013-10-22 12:45 ` Heinz Graalfs [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1382445911-55657-8-git-send-email-graalfs@linux.vnet.ibm.com \
--to=graalfs@linux.vnet.ibm.com \
--cc=borntraeger@de.ibm.com \
--cc=mst@redhat.com \
--cc=rusty@rustcorp.com.au \
--cc=virtualization@lists.linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).