[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 7/6] nbd/client: Ignore inaccessible tail of
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v3 7/6] nbd/client: Ignore inaccessible tail of inconsistent server |
Date: |
Fri, 29 Mar 2019 15:28:40 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.0 |
On 3/29/19 11:54 AM, Vladimir Sementsov-Ogievskiy wrote:
> 29.03.2019 19:34, Eric Blake wrote:
>> The NBD spec suggests that a server should never advertise a size
>> inconsistent with its minimum block alignment, as that tail is
>> effectively inaccessible to a compliant client obeying those block
>> constraints. Although the block layer likes to round up, here, we'd
>> prefer to truncate down to obey the spec, and note that it is the
>> server's fault for advertising bogus size.
>>
>> Does not impact either qemu (which always sends properly aligned
>> sizes) or nbdkit (which does not send minimum block requirements yet);
>> so this is mostly theoretical, to avoid potential asserts elsewhere in
>> the code that assume the size is aligned.
>>
>> }
>> + if (info->min_block &&
>> + !QEMU_IS_ALIGNED(info->size, info->min_block)) {
>> + trace_nbd_opt_info_go_unaligned_size(info->size,
>> + info->min_block);
>> + info->size = QEMU_ALIGN_DOWN(info->size, info->min_block);
>> + }
>> trace_nbd_receive_negotiate_size_flags(info->size,
>> info->flags);
>
> And this again leads to silently skip file tail on qemu-img convert from such
> nbd export.
> I don't really care, but if not Qemu neither nbdkit are affected, isn't it
> better just
> nbd_send_opt_abort and return -1 in this case? So we'll never have hidden
> troubles with
> third-party bad servers, and their developers will have to fix their code
> instead (even
> not written yet, I suppose).
The code below is an example of killing connection to an impossible server:
if (!is_power_of_2(info->min_block)) {
error_setg(errp, "server minimum block size %" PRIu32
" is not a power of two", info->min_block);
nbd_send_opt_abort(ioc);
return -1;
I'll copy that instead of silently truncating and proceeding on.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] [PATCH v3 4/6] nbd/client: Support qemu-img convert from unaligned size, (continued)
- [Qemu-devel] [PATCH v3 3/6] nbd/client: Report offsets in bdrv_block_status, Eric Blake, 2019/03/29
- [Qemu-devel] [PATCH v3 2/6] nbd/client: Lower min_block for block-status, unaligned size, Eric Blake, 2019/03/29
- Re: [Qemu-devel] [PATCH for-4.0 v3 0/6] NBD server alignment improvement, Richard W.M. Jones, 2019/03/29
- [Qemu-devel] [PATCH v3 7/6] nbd/client: Ignore inaccessible tail of inconsistent server, Eric Blake, 2019/03/29
- [Qemu-devel] [PATCH v3.1 3.5/6] nbd/client: Reject inaccessible tail of inconsistent server, Eric Blake, 2019/03/30
- [Qemu-devel] [PATCH v3 6.5/6] nbd/client: Trace server noncompliance on structured reads, Eric Blake, 2019/03/30