From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Stabellini Subject: [PATCH] wait for outstanding aio requests before unplugging the disk Date: Wed, 25 Mar 2009 14:58:52 +0000 Message-ID: <49CA46AC.4070709@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel List-Id: xen-devel@lists.xenproject.org Hi all, this patch adds a wait on the completion of any outstanding aio requests before unplugging the hard drive. Signed-off-by: Stefano Stabellini --- diff --git a/hw/ide.c b/hw/ide.c index 7031ba1..febc87e 100644 --- a/hw/ide.c +++ b/hw/ide.c @@ -3098,6 +3098,8 @@ static void _ide_unplug_harddisks(int start) fprintf(stderr, "No principal controller?\n"); return; } + /* wait for outstanding aio requests */ + qemu_aio_flush(); for (i = start; i < 4; i++) { s = principal_ide_controller->ide_if + i; if (!s->bs)