From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46364) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VoGL9-0000Jq-Ro for qemu-devel@nongnu.org; Wed, 04 Dec 2013 12:34:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VoGKz-0003Mz-Q4 for qemu-devel@nongnu.org; Wed, 04 Dec 2013 12:34:23 -0500 Received: from mail-ee0-x231.google.com ([2a00:1450:4013:c00::231]:58633) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VoGKz-0003ML-Iu for qemu-devel@nongnu.org; Wed, 04 Dec 2013 12:34:13 -0500 Received: by mail-ee0-f49.google.com with SMTP id c41so2404486eek.8 for ; Wed, 04 Dec 2013 09:34:12 -0800 (PST) Sender: Paolo Bonzini Message-ID: <529F6792.3020605@redhat.com> Date: Wed, 04 Dec 2013 18:34:10 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1386132925-16728-1-git-send-email-aik@ozlabs.ru> <1386132925-16728-3-git-send-email-aik@ozlabs.ru> In-Reply-To: <1386132925-16728-3-git-send-email-aik@ozlabs.ru> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/3] scsi-disk: check for meduim on ALLOW_MEDIUM_REMOVAL List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy Cc: qemu-devel@nongnu.org Il 04/12/2013 05:55, Alexey Kardashevskiy ha scritto: > This prevents the guest from preventing DVD medium removal when > there is no medium. > > Without this, if the user has ejected a DVD, it is possible to > have a block device with an open tray, no media but locked. This state is weird but should not be a problem. The tray can still be closed when it is open and locked: if (!start && !s->tray_open && s->tray_locked) { scsi_check_condition(r, bdrv_is_inserted(s->qdev.conf.bs) ? SENSE_CODE(ILLEGAL_REQ_REMOVAL_PREVENTED) : SENSE_CODE(NOT_READY_REMOVAL_PREVENTED)); return -1; } Note that start && s->tray_open && s->tray_locked executes the command normally, closing the tray and reporting that as a QMP event. Paolo > Signed-off-by: Alexey Kardashevskiy > --- > hw/scsi/scsi-disk.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c > index 08b6135..22b6859 100644 > --- a/hw/scsi/scsi-disk.c > +++ b/hw/scsi/scsi-disk.c > @@ -1622,7 +1622,6 @@ static int32_t scsi_disk_emulate_command(SCSIRequest *req, uint8_t *buf) > case RELEASE: > case RELEASE_10: > case START_STOP: > - case ALLOW_MEDIUM_REMOVAL: > case GET_CONFIGURATION: > case GET_EVENT_STATUS_NOTIFICATION: > case MECHANISM_STATUS: >