From patchwork Wed Feb 6 20:02:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 218730 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 75EB92C02C9 for ; Thu, 7 Feb 2013 07:02:29 +1100 (EST) Received: from localhost ([::1]:39557 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U3BCN-00087l-Cz for incoming@patchwork.ozlabs.org; Wed, 06 Feb 2013 15:02:27 -0500 Received: from eggs.gnu.org ([208.118.235.92]:39650) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U3BCG-00087e-Kt for qemu-devel@nongnu.org; Wed, 06 Feb 2013 15:02:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U3BCF-0005jM-CU for qemu-devel@nongnu.org; Wed, 06 Feb 2013 15:02:20 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55524) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U3BCF-0005hM-2z for qemu-devel@nongnu.org; Wed, 06 Feb 2013 15:02:19 -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 r16K2HXV017200 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 6 Feb 2013 15:02:17 -0500 Received: from localhost (ovpn-113-40.phx2.redhat.com [10.3.113.40]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r16K2FUG030851; Wed, 6 Feb 2013 15:02:16 -0500 Date: Wed, 6 Feb 2013 18:02:14 -0200 From: Luiz Capitulino To: qemu-devel Message-ID: <20130206180214.311f670a@redhat.com> Organization: Red Hat Mime-Version: 1.0 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: Kevin Wolf , phrdina@redhat.com, Markus Armbruster Subject: [Qemu-devel] [RFC for-1.4] Revert "block: fix block tray status" 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 This reverts commit 9ca111544c64b5abed2e79cf52e19a8f227b347b. That commit has added a weird side effect to QMP: on shutdown, QMP emits the DEVICE_TRAY_MOVED event for all empty drives that have closed trays. This happens because the tray state actually changes in the following code path: main loop exit bdrv_close_all() bdrv_close() bdrv_dev_change_media_cb() So, revert the commit as the real fix is to separate eject from bdrv_close() and also because it's not clear how important it is to have a 100% correct semantic for eject from HMP. Signed-off-by: Luiz Capitulino --- ** IMPORTANT: This is an RFC because I'm not totally sure we should apply it for 1.4, for the following reasons: 1. The worst we get is a gratuitous state change that triggers an QMP event 2. Commit 9ca1115 is a bit old and was introduced before 1.4 development 3. This is not the Right Thing either block.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block.c b/block.c index 50dab8e..d58c6cc 100644 --- a/block.c +++ b/block.c @@ -1178,9 +1178,9 @@ void bdrv_close(BlockDriverState *bs) bdrv_delete(bs->file); bs->file = NULL; } - } - bdrv_dev_change_media_cb(bs, false); + bdrv_dev_change_media_cb(bs, false); + } /*throttling disk I/O limits*/ if (bs->io_limits_enabled) {