From patchwork Wed Apr 18 13:12:03 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 153505 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 2BCEEB6FD6 for ; Wed, 18 Apr 2012 23:12:51 +1000 (EST) Received: from localhost ([::1]:57829 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SKUgf-0003LP-Rq for incoming@patchwork.ozlabs.org; Wed, 18 Apr 2012 09:12:45 -0400 Received: from eggs.gnu.org ([208.118.235.92]:49622) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SKUgS-00036F-22 for qemu-devel@nongnu.org; Wed, 18 Apr 2012 09:12:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SKUgL-0005NC-Tz for qemu-devel@nongnu.org; Wed, 18 Apr 2012 09:12:31 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:56612) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SKUgL-0005IP-Ly for qemu-devel@nongnu.org; Wed, 18 Apr 2012 09:12:25 -0400 Received: by mail-pb0-f45.google.com with SMTP id uo5so10390781pbc.4 for ; Wed, 18 Apr 2012 06:12:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=O5efwLYD4U1k++tE3AA6UtsJxXzP0kqcvZwTWqC38DA=; b=he+T7ClhTrX4j7biQuTlVKIGqxmovxcxUT0uU59wQ1RoZ8rB8zcYsSeoSvgOWC/Vnp 1sODUS5nTI/fTeyTZuc1kiFW0wtql/9xPOu0p9R1ZDNNFb4s0XD2dmoDDMVryJwp6SrD XVx4VgWB6Stb7bjyfwdxFDDtinfdm1LdiTf6dWF3h4CZl+Nb6zIOFGbnP/fCJDfCSrPM EhXSXggo+z2G4Tc0s1mVE5FSZljL+5qrDCV3UiRZArxncl5sRKeBVxbP1vh6zYE6YPV4 hZO7ckO49Oyr8UJ6UvsW2yG8GdjwJeYjyknS5X48X9xWbfTDr7NmfQJ1OWCWBmKvbJIO hWcw== Received: by 10.68.190.40 with SMTP id gn8mr6479747pbc.12.1334754744896; Wed, 18 Apr 2012 06:12:24 -0700 (PDT) Received: from yakj.usersys.redhat.com (93-34-182-16.ip50.fastwebnet.it. [93.34.182.16]) by mx.google.com with ESMTPS id nz8sm15709851pbb.68.2012.04.18.06.12.21 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 18 Apr 2012 06:12:23 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 18 Apr 2012 15:12:03 +0200 Message-Id: <1334754723-11153-4-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.9.3 In-Reply-To: <1334754723-11153-1-git-send-email-pbonzini@redhat.com> References: <1334754723-11153-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.45 Cc: kwolf@redhat.com, stefanha@linux.vnet.ibm.com Subject: [Qemu-devel] [PATCH 3/3] block: mark streaming job busy at the end 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 Kevin noted how the part of stream_run() that is after the for loop runs with s->common.busy = false. At least bdrv_change_backing_file() can yield, possibly other functions, too. The race window is really small but it's there. Thanks to the new, more flexible implementation of block_job_cancel_sync we can fix it easily. Signed-off-by: Paolo Bonzini --- block/stream.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/stream.c b/block/stream.c index d38f30a..ea3566d 100644 --- a/block/stream.c +++ b/block/stream.c @@ -149,6 +149,7 @@ retry: co_sleep_ns(rt_clock, 0); } + s->common.busy = true; if (!base) { bdrv_disable_copy_on_read(bs); }