All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Alberto Garcia <berto@igalia.com>, qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	Peter Maydell <peter.maydell@linaro.org>,
	qemu-stable <qemu-stable@nongnu.org>,
	qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>,
	John Snow <jsnow@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 2/4] blockdev: Fix 'change' for slot devices
Date: Fri, 22 Jan 2016 23:32:48 +0100	[thread overview]
Message-ID: <56A2AE10.8050601@redhat.com> (raw)
In-Reply-To: <w517fj2lyv8.fsf@maestria.local.igalia.com>

[-- Attachment #1: Type: text/plain, Size: 1473 bytes --]

On 22.01.2016 10:58, Alberto Garcia wrote:
> On Wed 20 Jan 2016 07:29:19 PM CET, Max Reitz wrote:
>> @@ -2424,6 +2442,15 @@ static void qmp_blockdev_insert_anon_medium(const char *device,
>>  
>>      blk_insert_bs(blk, bs);
>>  
>> +    if (!blk_dev_has_tray(blk)) {
>> +        /* For tray-less devices, blockdev-close-tray is a no-op (or may not be
>> +         * called at all); therefore, the medium needs to be pushed into the
>> +         * slot here.
>> +         * Do it after blk_insert_bs() so blk_is_inserted(blk) returns the @load
>> +         * value passed here (i.e. true). */
>> +        blk_dev_change_media_cb(blk, true);
>> +    }
>> +
>>      QTAILQ_INSERT_TAIL(&bdrv_states, bs, device_list);
>>  }
> 
> Any reason why you do this before updating bdrv_states ?

The reason is that I just moved it after blk_insert_bs(). But that's
wrong, QTAILQ_INSERT_TAIL() should be paired with blk_insert_bs()
without anything in between, thanks!

(I don't think it changes anything in practice, but it still is wrong.)

> If the device has a tray this would happen afterwards, in
> qmp_blockdev_close_tray().

Well, tray devices are no longer really a good comparison, because in
the opposite case (ejecting a medium), for them we open the tray and
then eject the medium; however, for trayless devices we now eject the
medium and only then "open the tray" (invoke blk_dev_change_media_cb()).

Anyway, will fix, thanks.

Max


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2016-01-22 22:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-20 18:29 [Qemu-devel] [PATCH v2 0/4] blockdev: Fix 'change' for slot devices Max Reitz
2016-01-20 18:29 ` [Qemu-devel] [PATCH v2 1/4] block: Add blk_dev_has_tray() Max Reitz
2016-01-20 18:29 ` [Qemu-devel] [PATCH v2 2/4] blockdev: Fix 'change' for slot devices Max Reitz
2016-01-20 20:26   ` Eric Blake
2016-01-22  9:58   ` Alberto Garcia
2016-01-22 22:32     ` Max Reitz [this message]
2016-01-20 18:29 ` [Qemu-devel] [PATCH v2 3/4] Revert "hw/block/fdc: Implement tray status" Max Reitz
2016-01-20 18:29 ` [Qemu-devel] [PATCH v2 4/4] block/qapi: Emit tray_open only if there is a tray Max Reitz
2016-01-20 20:27   ` Eric Blake
2016-01-22  9:48   ` Alberto Garcia
2016-01-21 15:10 ` [Qemu-devel] [PATCH v2 0/4] blockdev: Fix 'change' for slot devices Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56A2AE10.8050601@redhat.com \
    --to=mreitz@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berto@igalia.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.