qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [Qemu-block] [PATCH] block: Fix invalidate_cache error


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH] block: Fix invalidate_cache error path for parent activation
Date: Fri, 1 Feb 2019 13:53:02 +0800
User-agent: Mutt/1.10.1 (2018-07-13)

On Thu, Jan 31, 2019 at 03:31:51PM +0100, Kevin Wolf wrote:
> bdrv_co_invalidate_cache() clears the BDRV_O_INACTIVE flag before
> actually activating a node so that the correct permissions etc. are
> taken. In case of errors, the flag must be restored so that the next
> call to bdrv_co_invalidate_cache() retries activation.
> 
> Restoring the flag was missing in the error path for a failed
> parent->role->activate() call. The consequence is that this attempt to
> activate all images correctly fails because we still set errp, however
> on the next attempt BDRV_O_INACTIVE is already clear, so we return
> success without actually retrying the failed action.
> 
> An example where this is observable in practice is migration to a QEMU
> instance that has a raw format block node attached to a guest device
> with share-rw=off (the default) while another process holds
> BLK_PERM_WRITE for the same image. In this case, all activation steps
> before parent->role->activate() succeed because raw can tolerate other
> writers to the image. Only the parent callback (in particular
> blk_root_activate()) tries to implement the share-rw=on property and
> requests exclusive write permissions. This fails when the migration
> completes and correctly displays an error. However, a manual 'cont' will
> incorrectly resume the VM without calling blk_root_activate() again.
> 
> This case is described in more detail in the following bug report:
> https://bugzilla.redhat.com/show_bug.cgi?id=1531888
> 
> Fix this by correctly restoring the BDRV_O_INACTIVE flag in the error
> path.
> 
> Cc: address@hidden
> Signed-off-by: Kevin Wolf <address@hidden>
> ---
>  block.c | 1 +
>  1 file changed, 1 insertion(+)

Reviewed-by: Stefan Hajnoczi <address@hidden>

Attachment: signature.asc
Description: PGP signature


reply via email to

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