From patchwork Thu Jun 25 12:53:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 488442 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 30C8F1402DE for ; Thu, 25 Jun 2015 22:53:47 +1000 (AEST) Received: from localhost ([::1]:55602 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z86f3-0000I2-7v for incoming@patchwork.ozlabs.org; Thu, 25 Jun 2015 08:53:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40416) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z86ea-000832-JV for qemu-devel@nongnu.org; Thu, 25 Jun 2015 08:53:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z86eZ-0005RO-P8 for qemu-devel@nongnu.org; Thu, 25 Jun 2015 08:53:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43281) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z86eU-0005O8-Oj; Thu, 25 Jun 2015 08:53:10 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 25021A0E6D; Thu, 25 Jun 2015 12:53:10 +0000 (UTC) Received: from localhost (ovpn-112-85.ams2.redhat.com [10.36.112.85]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t5PCr8je024146; Thu, 25 Jun 2015 08:53:09 -0400 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Date: Thu, 25 Jun 2015 13:53:08 +0100 Message-Id: <1435236788-9176-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: qemu-block@nongnu.org, Jeff Cody , qemu-stable@nongnu.org, mreitz@redhat.com, Stefan Hajnoczi , John Snow Subject: [Qemu-devel] [PATCH for-2.4] block: keep bitmap if incremental backup job is cancelled 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 Reclaim the dirty bitmap if an incremental backup block job is cancelled. The ret variable may be 0 when the job is cancelled so it's not enough to check ret < 0. Reviewed-by: John Snow Reviewed-by: Max Reitz Signed-off-by: Stefan Hajnoczi --- block/backup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/backup.c b/block/backup.c index 4a1af68..ddf8424 100644 --- a/block/backup.c +++ b/block/backup.c @@ -431,7 +431,7 @@ static void coroutine_fn backup_run(void *opaque) if (job->sync_bitmap) { BdrvDirtyBitmap *bm; - if (ret < 0) { + if (ret < 0 || block_job_is_cancelled(&job->common)) { /* Merge the successor back into the parent, delete nothing. */ bm = bdrv_reclaim_dirty_bitmap(bs, job->sync_bitmap, NULL); assert(bm);