From patchwork Wed Feb 3 18:32:28 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naphtali Sprei X-Patchwork-Id: 44404 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 008EDB7D4A for ; Thu, 4 Feb 2010 05:42:18 +1100 (EST) Received: from localhost ([127.0.0.1]:42856 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NckAQ-0003mo-8p for incoming@patchwork.ozlabs.org; Wed, 03 Feb 2010 13:41:34 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nck24-00019a-GW for qemu-devel@nongnu.org; Wed, 03 Feb 2010 13:32:56 -0500 Received: from [199.232.76.173] (port=32964 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nck23-000195-N1 for qemu-devel@nongnu.org; Wed, 03 Feb 2010 13:32:55 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Nck20-0000Ir-Va for qemu-devel@nongnu.org; Wed, 03 Feb 2010 13:32:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:9471) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Nck1y-0000Ic-Jx for qemu-devel@nongnu.org; Wed, 03 Feb 2010 13:32:52 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o13IWnfb001272 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 3 Feb 2010 13:32:49 -0500 Received: from localhost.localdomain (dhcp-0-60.tlv.redhat.com [10.35.0.60]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o13IWeod011971; Wed, 3 Feb 2010 13:32:48 -0500 From: Naphtali Sprei To: qemu-devel@nongnu.org Date: Wed, 3 Feb 2010 20:32:28 +0200 Message-Id: <1265221948-12613-5-git-send-email-nsprei@redhat.com> In-Reply-To: <1265221948-12613-4-git-send-email-nsprei@redhat.com> References: <1265221948-12613-1-git-send-email-nsprei@redhat.com> <1265221948-12613-2-git-send-email-nsprei@redhat.com> <1265221948-12613-3-git-send-email-nsprei@redhat.com> <1265221948-12613-4-git-send-email-nsprei@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Naphtali Sprei Subject: [Qemu-devel] [PATCH 4/4] Open backing file read-only also for snapshot mode X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Naphtali Sprei --- block.c | 10 +--------- 1 files changed, 1 insertions(+), 9 deletions(-) diff --git a/block.c b/block.c index 527b146..1db9961 100644 --- a/block.c +++ b/block.c @@ -483,19 +483,11 @@ int bdrv_open2(BlockDriverState *bs, const char *filename, int flags, if (bs->backing_format[0] != '\0') back_drv = bdrv_find_format(bs->backing_format); - open_flags &= ~BDRV_O_RDWR; /* clear RW, then restore from orig */ - if (bs->is_temporary) { - open_flags |= (flags & BDRV_O_RDWR); - } + open_flags &= ~BDRV_O_RDWR; ret = bdrv_open2(bs->backing_hd, backing_filename, open_flags, back_drv); if (ret < 0) { - open_flags &= ~BDRV_O_RDWR; /* Fall-back to read-only for the backing file */ - ret = bdrv_open2(bs->backing_hd, backing_filename, open_flags, - back_drv); - } - if (ret < 0) { bdrv_close(bs); return ret; }