[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH RESEND 15/50] block: Fail requests to empty Bloc
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH RESEND 15/50] block: Fail requests to empty BlockBackend |
Date: |
Tue, 27 Jan 2015 14:24:24 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 |
On 01/27/2015 12:45 PM, Max Reitz wrote:
> If there is no BlockDriverState in a BlockBackend or if the tray of the
> guest device is open, fail all requests (where that is possible) with
> -ENOMEDIUM.
>
> The reason the status of the guest device is taken into account is
> because once the guest device's tray is opened, any request on the same
> BlockBackend as the guest uses should fail. If the BDS tree is supposed
> to be usable even after ejecting it from the guest, a different
> BlockBackend must be used.
>
> Signed-off-by: Max Reitz <address@hidden>
> ---
> block/block-backend.c | 43 ++++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 42 insertions(+), 1 deletion(-)
>
> @@ -635,6 +635,10 @@ int blk_pwrite(BlockBackend *blk, int64_t offset, const
> void *buf, int count)
>
> int64_t blk_getlength(BlockBackend *blk)
> {
> + if (!blk_is_available(blk)) {
> + return -ENOMEDIUM;
> + }
> +
> return bdrv_getlength(blk->bs);
> }
If you add blk_nb_sectors, it will probably need the same treatment.
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH RESEND 18/50] block: Respect empty BB in bdrv_query_info(), (continued)
- [Qemu-devel] [PATCH RESEND 18/50] block: Respect empty BB in bdrv_query_info(), Max Reitz, 2015/01/27
- [Qemu-devel] [PATCH RESEND 16/50] block: Prepare remaining BB functions for NULL BDS, Max Reitz, 2015/01/27
- [Qemu-devel] [PATCH RESEND 10/50] block: Remove wr_highest_offset from BlockAcctStats, Max Reitz, 2015/01/27
- [Qemu-devel] [PATCH RESEND 19/50] blockdev: Use BlockBackend for blockdev-backup TA, Max Reitz, 2015/01/27
- [Qemu-devel] [PATCH RESEND 15/50] block: Fail requests to empty BlockBackend, Max Reitz, 2015/01/27
- Re: [Qemu-devel] [PATCH RESEND 15/50] block: Fail requests to empty BlockBackend,
Eric Blake <=
- [Qemu-devel] [PATCH RESEND 21/50] blockdev: Check BB validity in internal snapshot TA, Max Reitz, 2015/01/27
- [Qemu-devel] [PATCH RESEND 25/50] blockdev: Check BB validity in block-commit, Max Reitz, 2015/01/27
- [Qemu-devel] [PATCH RESEND 26/50] blockdev: Check BB validity in drive-backup, Max Reitz, 2015/01/27
- [Qemu-devel] [PATCH RESEND 27/50] blockdev: Check BB validity in blockdev-backup, Max Reitz, 2015/01/27
- [Qemu-devel] [PATCH RESEND 29/50] blockdev: Check BB validity in find_block_job(), Max Reitz, 2015/01/27