From patchwork Mon Aug 18 15:07:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 381035 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 9DBE0140097 for ; Tue, 19 Aug 2014 01:09:21 +1000 (EST) Received: from localhost ([::1]:44253 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XJOYh-0006Yg-Nj for incoming@patchwork.ozlabs.org; Mon, 18 Aug 2014 11:09:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44578) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XJOX0-0003vR-DU for qemu-devel@nongnu.org; Mon, 18 Aug 2014 11:07:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XJOWu-0001VW-8c for qemu-devel@nongnu.org; Mon, 18 Aug 2014 11:07:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:25274) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XJOWu-0001VS-0H for qemu-devel@nongnu.org; Mon, 18 Aug 2014 11:07:28 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s7IF7QG3004316 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 18 Aug 2014 11:07:27 -0400 Received: from localhost (ovpn-112-61.ams2.redhat.com [10.36.112.61]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s7IF7Pd1010224; Mon, 18 Aug 2014 11:07:26 -0400 From: Stefan Hajnoczi To: Date: Mon, 18 Aug 2014 16:07:13 +0100 Message-Id: <1408374433-5360-3-git-send-email-stefanha@redhat.com> In-Reply-To: <1408374433-5360-1-git-send-email-stefanha@redhat.com> References: <1408374433-5360-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Kevin Wolf , Paolo Bonzini , Fam Zheng , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH 2/2] virtio-blk: allow drive_del with dataplane X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Now that drive_del acquires the AioContext we can safely allow deleting the drive. As with non-dataplane mode, all I/Os submitted by the guest after drive_del will return EIO. This patch makes hot unplug work with virtio-blk dataplane. Previously drive_del reported an error because the device was busy. Signed-off-by: Stefan Hajnoczi --- hw/block/dataplane/virtio-blk.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c index d6ba65c..907d5c7 100644 --- a/hw/block/dataplane/virtio-blk.c +++ b/hw/block/dataplane/virtio-blk.c @@ -192,6 +192,7 @@ void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *blk, error_setg(&s->blocker, "block device is in use by data plane"); bdrv_op_block_all(blk->conf.bs, s->blocker); + bdrv_op_unblock(blk->conf.bs, BLOCK_OP_TYPE_DRIVE_DEL, s->blocker); *dataplane = s; }