From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
rjones@redhat.com, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/4] nbd/server: Advertise actual minimum block size
Date: Fri, 17 Aug 2018 16:49:17 +0300 [thread overview]
Message-ID: <c7dc405d-0b83-b680-6e45-db4b211d3ef2@virtuozzo.com> (raw)
In-Reply-To: <20180802144834.520904-3-eblake@redhat.com>
02.08.2018 17:48, Eric Blake wrote:
> Both NBD_CMD_BLOCK_STATUS and structured NBD_CMD_READ will split
> their reply according to bdrv_block_status() boundaries. If the
> block device has a request_alignment smaller than 512, but we
> advertise a block alignment of 512 to the client, then this can
> result in the server reply violating client expectations by
> reporting a smaller region of the export than what the client
> is permitted to address. Thus, it is imperative that we
> advertise the actual minimum block limit, rather than blindly
> rounding it up to 512 (bdrv_block_status() cannot return status
> aligned any smaller than request_alignment).
>
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
> nbd/server.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/nbd/server.c b/nbd/server.c
> index ea5fe0eb336..cd3c41f895b 100644
> --- a/nbd/server.c
> +++ b/nbd/server.c
> @@ -608,10 +608,12 @@ static int nbd_negotiate_handle_info(NBDClient *client, uint16_t myflags,
> /* Send NBD_INFO_BLOCK_SIZE always, but tweak the minimum size
> * according to whether the client requested it, and according to
> * whether this is OPT_INFO or OPT_GO. */
> - /* minimum - 1 for back-compat, or 512 if client is new enough.
> - * TODO: consult blk_bs(blk)->bl.request_alignment? */
> - sizes[0] =
> - (client->opt == NBD_OPT_INFO || blocksize) ? BDRV_SECTOR_SIZE : 1;
> + /* minimum - 1 for back-compat, or actual if client will obey it. */
> + if (client->opt == NBD_OPT_INFO || blocksize) {
> + sizes[0] = blk_get_request_alignment(exp->blk);
> + } else {
> + sizes[0] = 1;
> + }
> /* preferred - Hard-code to 4096 for now.
> * TODO: is blk_bs(blk)->bl.opt_transfer appropriate? */
> sizes[1] = 4096;
Here, what about dirty bitmap export through BLOCK_STATUS? Could it's
granularity be less than request_alignment? Shouldn't we handle it somehow?
--
Best regards,
Vladimir
next prev parent reply other threads:[~2018-08-17 13:49 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-02 14:48 [Qemu-devel] [PATCH 0/4 for-3.0?] NBD fixes for unaligned images Eric Blake
2018-08-02 14:48 ` [Qemu-devel] [PATCH 1/4] block: Add bdrv_get_request_alignment() Eric Blake
2018-08-17 13:41 ` Vladimir Sementsov-Ogievskiy
2018-08-02 14:48 ` [Qemu-devel] [PATCH 2/4] nbd/server: Advertise actual minimum block size Eric Blake
2018-08-17 13:49 ` Vladimir Sementsov-Ogievskiy [this message]
2018-08-17 14:53 ` Eric Blake
2018-08-17 15:04 ` Vladimir Sementsov-Ogievskiy
2018-08-17 15:11 ` Eric Blake
2018-08-02 14:48 ` [Qemu-devel] [PATCH 3/4] iotests: Add 228 to test NBD on unaligned images Eric Blake
2018-08-02 14:48 ` [Qemu-devel] [PATCH 4/4] nbd/client: Deal with unaligned size from server Eric Blake
2018-08-17 13:57 ` Vladimir Sementsov-Ogievskiy
2018-08-17 15:01 ` Eric Blake
2018-09-10 19:25 ` [Qemu-devel] [Qemu-block] [PATCH 0/4 for-3.0?] NBD fixes for unaligned images John Snow
2018-09-10 19:35 ` Eric Blake
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=c7dc405d-0b83-b680-6e45-db4b211d3ef2@virtuozzo.com \
--to=vsementsov@virtuozzo.com \
--cc=eblake@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=rjones@redhat.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).