From patchwork Wed Apr 12 17:49:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Blake X-Patchwork-Id: 750099 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 3w3BNg0Zljz9s8V for ; Thu, 13 Apr 2017 03:53:23 +1000 (AEST) Received: from localhost ([::1]:45631 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cyMSG-0005vB-FG for incoming@patchwork.ozlabs.org; Wed, 12 Apr 2017 13:53:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45033) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cyMOz-0003gT-Oe for qemu-devel@nongnu.org; Wed, 12 Apr 2017 13:49:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cyMOw-00074W-MI for qemu-devel@nongnu.org; Wed, 12 Apr 2017 13:49:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52992) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cyMOu-00072g-I0; Wed, 12 Apr 2017 13:49:52 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 68292C05490C; Wed, 12 Apr 2017 17:49:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 68292C05490C Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=eblake@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 68292C05490C Received: from red.redhat.com (ovpn-122-61.rdu2.redhat.com [10.10.122.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id A894077EA0; Wed, 12 Apr 2017 17:49:46 +0000 (UTC) From: Eric Blake To: qemu-devel@nongnu.org Date: Wed, 12 Apr 2017 12:49:10 -0500 Message-Id: <20170412174920.8744-3-eblake@redhat.com> In-Reply-To: <20170412174920.8744-1-eblake@redhat.com> References: <20170412174920.8744-1-eblake@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 12 Apr 2017 17:49:51 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 02/12] migration: Don't lose errno across aio context changes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, famz@redhat.com, qemu-block@nongnu.org, Juan Quintela , qemu-stable@nongnu.org, "Dr. David Alan Gilbert" , Stefan Hajnoczi , jsnow@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" set_drity_tracking() was assuming that the errno value set by bdrv_create_dirty_bitmap() would not be corrupted by either blk_get_aio_context() or aio_context_release(). Rather than audit whether this assumption is safe, rewrite the code to just grab the value of errno sooner. CC: qemu-stable@nongnu.org Signed-off-by: Eric Blake Reviewed-by: John Snow Reviewed-by: Juan Quintela --- migration/block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/block.c b/migration/block.c index 18d50ff..9a9c214 100644 --- a/migration/block.c +++ b/migration/block.c @@ -350,9 +350,9 @@ static int set_dirty_tracking(void) aio_context_acquire(blk_get_aio_context(bmds->blk)); bmds->dirty_bitmap = bdrv_create_dirty_bitmap(blk_bs(bmds->blk), BLOCK_SIZE, NULL, NULL); + ret = -errno; aio_context_release(blk_get_aio_context(bmds->blk)); if (!bmds->dirty_bitmap) { - ret = -errno; goto fail; } }