qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC for-1.4] Revert "block: fix block tray status"


From: Kevin Wolf
Subject: Re: [Qemu-devel] [RFC for-1.4] Revert "block: fix block tray status"
Date: Thu, 07 Feb 2013 14:12:10 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120605 Thunderbird/13.0

Am 06.02.2013 21:02, schrieb Luiz Capitulino:
> 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 <address@hidden>
> ---
> 
> ** 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) {

I think the right solution is to move the bdrv_dev_change_media_cb()
call to those callers of bdrv_close() that actually need it. I haven't
checked it yet in detail, but at the first sight it looks like
eject_device() and do_drive_del() are the only ones that need it.

Such a change I'd rather move to 1.5, though. Do you think it's
important to get rid of these (admittedly odd) artefacts for 1.4?

Kevin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]