From patchwork Mon Mar 4 09:15:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 224659 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 0DBA02C030B for ; Mon, 4 Mar 2013 20:20:52 +1100 (EST) Received: from localhost ([::1]:44961 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCRZh-0006IQ-Nw for incoming@patchwork.ozlabs.org; Mon, 04 Mar 2013 04:20:49 -0500 Received: from eggs.gnu.org ([208.118.235.92]:40946) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCRV0-0006nR-8O for qemu-devel@nongnu.org; Mon, 04 Mar 2013 04:16:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UCRUx-00022s-5l for qemu-devel@nongnu.org; Mon, 04 Mar 2013 04:15:58 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58949) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCRUw-00022h-D1 for qemu-devel@nongnu.org; Mon, 04 Mar 2013 04:15:54 -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.14.4/8.14.4) with ESMTP id r249FrRY022690 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 4 Mar 2013 04:15:53 -0500 Received: from localhost (ovpn-112-32.ams2.redhat.com [10.36.112.32]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r249FqkF018995; Mon, 4 Mar 2013 04:15:53 -0500 From: Stefan Hajnoczi To: Date: Mon, 4 Mar 2013 10:15:31 +0100 Message-Id: <1362388531-32305-10-git-send-email-stefanha@redhat.com> In-Reply-To: <1362388531-32305-1-git-send-email-stefanha@redhat.com> References: <1362388531-32305-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Anthony Liguori , Jeff Cody , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH 9/9] block: for HMP commit() operations on 'all', skip non-COW drives 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 From: Jeff Cody During a commit of 'all' using the HMP non-live commit, the operation is aborted and returns error on the first error enountered. When non-COW drives are in use (e.g. ejected floppy, cdrom, or drives without a backing parent), that means a commit all will return an error of either -ENOMEDIUM or -ENOTSUP. This is not desirable, so for the 'all' commit case, only attempt the commit if both bs->drv and bs->backing_hd are present. More succinctly: 'commit all' now means a commit on all COW drives. This means an individual commit to a specific non-COW drive will still return the appropriate error (-ENOMEDIUM if eject / not present, -ENOTSUP if no backing file). Reported-by: Jan Kiszka Signed-off-by: Jeff Cody Reviewed-by: Paolo Bonzini Reviewed-by: Kevin Wolf Signed-off-by: Stefan Hajnoczi --- block.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/block.c b/block.c index 4582961..124a9eb 100644 --- a/block.c +++ b/block.c @@ -1640,9 +1640,11 @@ int bdrv_commit_all(void) BlockDriverState *bs; QTAILQ_FOREACH(bs, &bdrv_states, list) { - int ret = bdrv_commit(bs); - if (ret < 0) { - return ret; + if (bs->drv && bs->backing_hd) { + int ret = bdrv_commit(bs); + if (ret < 0) { + return ret; + } } } return 0;