qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
	qemu-devel@nongnu.org, qemu-block@nongnu.org,
	qemu-stable@nongnu.org
Cc: pbonzini@redhat.com, John Snow <jsnow@redhat.com>, den@openvz.org
Subject: Re: [Qemu-devel] [PATCH] nbd/server: fix bitmap export
Date: Fri, 14 Sep 2018 13:12:04 -0500	[thread overview]
Message-ID: <ec75cbe9-8854-9323-db48-1783a657852f@redhat.com> (raw)
In-Reply-To: <05b6e954-744f-d52c-1f5e-51d52062e195@redhat.com>

On 9/14/18 12:24 PM, Eric Blake wrote:
> On 9/14/18 11:51 AM, Vladimir Sementsov-Ogievskiy wrote:
>> bitmap_to_extents function is broken: it switches dirty variable after
>> every iteration, however it can process only part of dirty (or zero)
>> area during one iteration in case when this area is too large for one
>> extent.
>>
>> Fortunately, the bug don't produce wrong extents: it just inserts
>> zero-length extents between sequential extents representing large dirty
>> (or zero) area. However, zero-length extents are abandoned by NBD
> 
> s/abandoned by/forbidden by the/
> 
>> protocol. So, careful client should consider such replay as server
> 
> s/replay/reply/
> 
>> fault and not-careful will likely ignore zero-length extents.
> 
> Which camp is qemu 3.0 as client in? Does it tolerate the zero-length 
> extent, and still manage to see correct information overall, or does it 
> crash?
> 
> Hmm - I think we're "safe" with qemu as client - right now, the only way 
> qemu 3.0 accesses the qemu dirty bitmap over NBD is with my 
> x-dirty-bitmap hack (commit 216ee3657), which uses 
> block/nbd-client.c:nbd_client_co_block_status() to read the bitmap, and 
> that always passes NBD_CMD_FLAG_REQ_ONE.  qemu will assert() if 
> nbd_client_co_block_status() doesn't make any progress, but from what 
> I'm reading of your bug report, qemu as client never permits the server 
> to answer with more than one extent, and the bug of a zero-length extent 
> is triggered only after the first extent has been sent.

A further mitigation - the bug can only occur for a client that requests 
block status with a length in the range (4G-bitmap_granularity, 4G). 
Otherwise, the loop terminates after the extent that got truncated to 
4G-bitmap_granularity, preventing the next iteration of the loop from 
detecting a 0-length extent.

> 
> Thus, the primary reason to accept this patch is not because of qemu 3.0 
> as client, but for interoperability with other clients.  I'm planning on 
> updating the commit message to add these additional details.
> 
-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

      parent reply	other threads:[~2018-09-14 18:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-14 16:51 [Qemu-devel] [PATCH] nbd/server: fix bitmap export Vladimir Sementsov-Ogievskiy
2018-09-14 17:24 ` Eric Blake
2018-09-14 17:30   ` Vladimir Sementsov-Ogievskiy
2018-09-14 17:35     ` Eric Blake
2018-09-14 17:47       ` Vladimir Sementsov-Ogievskiy
2018-09-14 17:38     ` Vladimir Sementsov-Ogievskiy
2018-09-14 18:12   ` Eric Blake [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ec75cbe9-8854-9323-db48-1783a657852f@redhat.com \
    --to=eblake@redhat.com \
    --cc=den@openvz.org \
    --cc=jsnow@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=vsementsov@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).