From: Rusty Russell <rusty@rustcorp.com.au>
To: Heinz Graalfs <graalfs@linux.vnet.ibm.com>,
mst@redhat.com, virtualization@lists.linux-foundation.org
Cc: borntraeger@de.ibm.com
Subject: Re: [PATCH RFC 4/7] virtio_blk: use dummy virtqueue_notify() to detect host kick error
Date: Wed, 23 Oct 2013 10:32:15 +1030 [thread overview]
Message-ID: <8738nskg6w.fsf@rustcorp.com.au> (raw)
In-Reply-To: <1382445911-55657-5-git-send-email-graalfs@linux.vnet.ibm.com>
Heinz Graalfs <graalfs@linux.vnet.ibm.com> writes:
> Deleting the disk and partitions in virtblk_remove() via del_gendisk() causes
> never ending waits when trying to synch dirty inode pages.
>
> A dummy virtqueue_notify() in virtblk_remove() is used to detect a host
> notification error, latter occurs when block device was hot-unplugged.
> When the dummy host kick failed blk_cleanup_queue() should be invoked
> prior to del_gendisk().
>
> Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
> ---
> drivers/block/virtio_blk.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> index 6472395..98f081a 100644
> --- a/drivers/block/virtio_blk.c
> +++ b/drivers/block/virtio_blk.c
> @@ -880,8 +880,14 @@ static void virtblk_remove(struct virtio_device *vdev)
> vblk->config_enable = false;
> mutex_unlock(&vblk->config_lock);
>
> - del_gendisk(vblk->disk);
> - blk_cleanup_queue(vblk->disk->queue);
> + virtqueue_notify(vblk->vq);
> + if (virtqueue_is_broken(vblk->vq)) {
> + blk_cleanup_queue(vblk->disk->queue);
> + del_gendisk(vblk->disk);
> + } else {
> + del_gendisk(vblk->disk);
> + blk_cleanup_queue(vblk->disk->queue);
> + }
This seems horribly wrong. Firstly, it's ugly to have a gratuitous
kick. Secondly, it's racy: what if there's a hot unplug (or other
failure) after your virtqueue_is_broken() test? We should be doing I/O
failures which should be handled by del_gendisk() correctly.
Cheers,
Rusty.
next prev parent reply other threads:[~2013-10-23 0:02 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 [this message]
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 ` [PATCH RFC 7/7] virtio_blk: trigger IO errors " Heinz Graalfs
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=8738nskg6w.fsf@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=borntraeger@de.ibm.com \
--cc=graalfs@linux.vnet.ibm.com \
--cc=mst@redhat.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.