From: Eric Blake <eblake@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Cc: kwolf@redhat.com, hreitz@redhat.com, qemu-devel@nongnu.org,
qemu-block@nongnu.org
Subject: Re: [RFC for-6.2] block/nbd: forbid incompatible change of server options on reconnect
Date: Mon, 29 Nov 2021 13:16:06 -0600 [thread overview]
Message-ID: <20211129191606.4cnbnjpsoywgxeq7@redhat.com> (raw)
In-Reply-To: <20211124140951.439684-1-vsementsov@virtuozzo.com>
On Wed, Nov 24, 2021 at 03:09:51PM +0100, Vladimir Sementsov-Ogievskiy wrote:
> Reconnect feature was never prepared to handle server options changed
> on reconnect. Let's be stricter and check what exactly is changed. If
> server capabilities just got richer don't worry. Otherwise fail and
> drop the established connection.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
> + /*
> + * No worry if rotational status changed. But other flags are feature flags,
> + * they should not degrade.
> + */
> + dropped_flags = (old->flags & ~new->flags) & ~NBD_FLAG_ROTATIONAL;
> + if (dropped_flags) {
> + error_setg(errp, "Server options degrade after reconnect: flags 0x%"
> + PRIx32 " are not reported anymore", dropped_flags);
> + return false;
> + }
Your logic is good for most flags, but somewhat wrong for
NBD_FLAG_READ_ONLY_BIT. For cases where we are only using the block
device read-only, we don't care about changes of that bit, in either
direction. But for cases where we want to use the block device
read-write, the bit changing from clear in the old to set in the new
server is an incompatible change that your logic failed to flag.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
next prev parent reply other threads:[~2021-11-29 19:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-24 14:09 [RFC for-6.2] block/nbd: forbid incompatible change of server options on reconnect Vladimir Sementsov-Ogievskiy
2021-11-29 17:34 ` Eric Blake
2021-11-29 20:47 ` Vladimir Sementsov-Ogievskiy
2021-11-29 19:16 ` Eric Blake [this message]
2021-11-29 20:49 ` Vladimir Sementsov-Ogievskiy
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=20211129191606.4cnbnjpsoywgxeq7@redhat.com \
--to=eblake@redhat.com \
--cc=hreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@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).