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@xxxxxxxxxxxxxxxxxx> --- 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); + } /* Stop all the virtqueues. */ vdev->config->reset(vdev); -- 1.8.3.1 _______________________________________________ Virtualization mailing list Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linuxfoundation.org/mailman/listinfo/virtualization