All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Bligh <alex@alex.org.uk>
To: Eric Blake <eblake@redhat.com>
Cc: Alex Bligh <alex@alex.org.uk>, Bob Chen <a175818323@gmail.com>,
	Stefan Hajnoczi <stefanha@gmail.com>,
	"nbd-general@lists.sourceforge.net"
	<nbd-general@lists.sourceforge.net>,
	qemu block <qemu-block@nongnu.org>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [Qemu-block] [Nbd] How to online resize qemu disk with nbd protocol?
Date: Thu, 12 Jan 2017 18:56:42 +0000	[thread overview]
Message-ID: <B07FDA27-AF64-4BF1-874A-9B4AF201BA8E@alex.org.uk> (raw)
In-Reply-To: <90b32a89-6dd8-1f83-4f6f-01bb5479252e@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 3103 bytes --]


> On 12 Jan 2017, at 18:45, Eric Blake <eblake@redhat.com> wrote:
> 
> On 01/12/2017 11:57 AM, Bob Chen wrote:
>> There might be a time window between the NBD server's resize and the
>> client's `re-read size` request. Is it safe?
> 
> For resize larger, it seems that it would be safe for the server to just
> remember the last size it has advertised to the client.  As long as the
> client doesn't request read/write to any offset beyond the
> last-advertised size (either the size the server gave at handshake, or
> the size that the server reported when the client last used the new
> 're-read size' command), there's no difference in behavior (and
> well-behaved clients fall in this group); if the client DOES try to
> access out-of-bounds with respect to the last known size, the server
> SHOULD reject the access, but MAY serve it instead.  A client that is
> unaware of the 're-read size' command will never learn that the server
> is now offering a larger image.
> 
> For resize smaller, things are a lot trickier - how do you block access
> to a portion of a file that the client still thinks exist, but which the
> server has truncated away?  Maybe the easy way out is to state that the
> server MUST NOT resize smaller.

I'm not sure why this is any harder than Qemu writing to a physical partition
that changes size. You need to change the size of things in order. To
resize smaller, you tell Qemu it's smaller, then resize the partition. To
resize larger, you resize the partition then tell Qemu it's larger.

This is incidentally exactly the same thing you do if you have a filing
system on a partition (or a filing system on a real nbd device - we could
support the same reread of geometry in kernel).

>> 
>> What about an active `resize` request from the client? Considering some NBD
>> servers might have the capability to do instant resizing, not applying to
>> LVM or host block device, of course...
> 
> And perhaps the 're-read size' command can serve a dual purpose.  Since
> all NBD commands already include space for size and offset parameters,
> we could define that if the client passes 0/0 for size and offset, it
> wants to read the server's current size; if it passes 0/non-zero, it is
> asking the server to resize to the new non-zero size (and the server's
> success or error response tells whether the resize happened).
> 
> Should I spend time turning this idea into a more formal spec, along the
> lines of other NBD extension proposals?

I'd support the reread bit. I'm less sure we ever want to push a new
size from the client. It seems a bit like a layering violation. Perhaps
I can be convinced.

My preferred way to do this would be essentially to allow NBD_OPT_INFO
to be sent (wrapped appropriately) during the main transmission phase.
That would allow *any* INFO stuff to be reread.

If it's just this (rather than a resize command) I guess it could
go into the NBD_OPT_INFO extension branch. If it's going to do
more than _INFO_, then I guess it needs its own extension.

--
Alex Bligh





[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 842 bytes --]

  reply	other threads:[~2017-01-12 18:56 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-12 10:22 [Qemu-devel] How to online resize qemu disk with nbd protocol? Bob Chen
2017-01-12 14:43 ` Eric Blake
2017-01-12 15:44   ` [Qemu-devel] [Nbd] " Alex Bligh
2017-01-12 16:54     ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2017-01-12 17:57       ` Bob Chen
2017-01-12 18:45         ` Eric Blake
2017-01-12 18:56           ` Alex Bligh [this message]
2017-01-14 14:48             ` [Qemu-devel] [Nbd] [Qemu-block] " Wouter Verhelst
2017-01-14 15:30               ` Alex Bligh
2017-01-14 14:45           ` Wouter Verhelst
2017-01-16 19:36             ` Eric Blake
2017-01-18  8:01               ` Wouter Verhelst
2017-01-22 10:25                 ` Bob Chen
2017-01-22 11:43                   ` Wouter Verhelst
2017-01-23 14:54                     ` Eric Blake
2017-01-23 15:27                       ` Alex Bligh
2017-01-25  8:47                       ` Wouter Verhelst
2017-11-14 16:41                       ` Eric Blake
2017-11-14 17:37                         ` Wouter Verhelst
2017-11-14 19:06                           ` Eric Blake
2017-11-16  9:51                             ` Wouter Verhelst
2017-11-16 15:30                               ` Eric Blake
2017-11-16 16:20                                 ` Wouter Verhelst
2017-11-23 11:42                                   ` Wouter Verhelst

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=B07FDA27-AF64-4BF1-874A-9B4AF201BA8E@alex.org.uk \
    --to=alex@alex.org.uk \
    --cc=a175818323@gmail.com \
    --cc=eblake@redhat.com \
    --cc=nbd-general@lists.sourceforge.net \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.