From patchwork Tue Feb 26 14:55:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Cody X-Patchwork-Id: 223233 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 5F9002C0293 for ; Wed, 27 Feb 2013 01:56:10 +1100 (EST) Received: from localhost ([::1]:41887 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UALwu-00036m-T9 for incoming@patchwork.ozlabs.org; Tue, 26 Feb 2013 09:56:08 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52206) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UALwj-00035I-BI for qemu-devel@nongnu.org; Tue, 26 Feb 2013 09:55:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UALwg-0002vX-Ly for qemu-devel@nongnu.org; Tue, 26 Feb 2013 09:55:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56923) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UALwg-0002vQ-EW for qemu-devel@nongnu.org; Tue, 26 Feb 2013 09:55:54 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r1QEtqUS006680 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 26 Feb 2013 09:55:52 -0500 Received: from localhost (ovpn-112-32.phx2.redhat.com [10.3.112.32]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r1QEtooF012964 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Tue, 26 Feb 2013 09:55:51 -0500 From: Jeff Cody To: qemu-devel@nongnu.org Date: Tue, 26 Feb 2013 09:55:48 -0500 Message-Id: <340453d16312b750540b462e80742aeb4e3a4625.1361890319.git.jcody@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, jan.kiszka@siemens.com, armbru@redhat.com, stefanha@redhat.com Subject: [Qemu-devel] [PATCH] 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 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 --- block.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/block.c b/block.c index 50dab8e..7a105dc 100644 --- a/block.c +++ b/block.c @@ -1620,9 +1620,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;