From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51023) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMkGL-0008Fm-NJ for qemu-devel@nongnu.org; Fri, 22 Jan 2016 17:33:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aMkGK-00087C-So for qemu-devel@nongnu.org; Fri, 22 Jan 2016 17:33:01 -0500 References: <1453314561-10486-1-git-send-email-mreitz@redhat.com> <1453314561-10486-3-git-send-email-mreitz@redhat.com> From: Max Reitz Message-ID: <56A2AE10.8050601@redhat.com> Date: Fri, 22 Jan 2016 23:32:48 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="VHOvvMU25l58rPHUMtrmx2JxsO7XoG8Om" Subject: Re: [Qemu-devel] [PATCH v2 2/4] blockdev: Fix 'change' for slot devices List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alberto Garcia , qemu-block@nongnu.org Cc: Kevin Wolf , Peter Maydell , qemu-stable , qemu-devel@nongnu.org, Markus Armbruster , John Snow This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --VHOvvMU25l58rPHUMtrmx2JxsO7XoG8Om Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable 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(con= st char *device, >> =20 >> blk_insert_bs(blk, bs); >> =20 >> + 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 i= nto the >> + * slot here. >> + * Do it after blk_insert_bs() so blk_is_inserted(blk) return= s the @load >> + * value passed here (i.e. true). */ >> + blk_dev_change_media_cb(blk, true); >> + } >> + >> QTAILQ_INSERT_TAIL(&bdrv_states, bs, device_list); >> } >=20 > 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 --VHOvvMU25l58rPHUMtrmx2JxsO7XoG8Om Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJWoq4QAAoJEDuxQgLoOKytCwcIAINQJAsDwhv0KdpZO2zr2CBl 170iYTbriLocCCkAO/0Jxyat5lduNRwxD7ndWh97j0PgKD1IY9X3SXC/F6xvLO4m 0tJ+WpDaydPT03PnL084/WuBqCk37qZjk3EbPE3zdg9MGvMk/IDhjC7z9ugrj8Qi Qq5rg28qi90sQ9UN014OmYpCXFJm47Bwv+zPeZd06SXqalRKPywJeBeSxrDutrW0 nej5OS01VGHr3j2RHPkza7sfYLFJHYdys1K49obJnXZqmvciCBMVa/fp5RoxGDJq FrzZq13HGJYIGsLK1wdEASNqG/lgp7UxVWyHNcNynZPEaH+m9nrn1cH7n2Ne0Ro= =oSA3 -----END PGP SIGNATURE----- --VHOvvMU25l58rPHUMtrmx2JxsO7XoG8Om--