diff mbox series

nbd/server: Allow LIST_META_CONTEXT without STRUCTURED_REPLY

Message ID 20210907173505.1499709-1-eblake@redhat.com (mailing list archive)
State New, archived
Headers show
Series nbd/server: Allow LIST_META_CONTEXT without STRUCTURED_REPLY | expand

Commit Message

Eric Blake Sept. 7, 2021, 5:35 p.m. UTC
The NBD protocol just relaxed the requirements on
NBD_OPT_LIST_META_CONTEXT:

https://github.com/NetworkBlockDevice/nbd/commit/13a4e33a87

Since listing is not stateful (unlike SET_META_CONTEXT), we don't care
if a client asks for meta contexts without first requesting structured
replies.  Well-behaved clients will still ask for structured reply
first (if for no other reason than for back-compat to older servers),
but that's no reason to avoid this change.

Signed-off-by: Eric Blake <eblake@redhat.com>
---
 nbd/server.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Vladimir Sementsov-Ogievskiy Sept. 14, 2021, 2:19 p.m. UTC | #1
07.09.2021 20:35, Eric Blake wrote:
> The NBD protocol just relaxed the requirements on
> NBD_OPT_LIST_META_CONTEXT:
> 
> https://github.com/NetworkBlockDevice/nbd/commit/13a4e33a87
> 
> Since listing is not stateful (unlike SET_META_CONTEXT), we don't care
> if a client asks for meta contexts without first requesting structured
> replies.  Well-behaved clients will still ask for structured reply
> first (if for no other reason than for back-compat to older servers),
> but that's no reason to avoid this change.
> 
> Signed-off-by: Eric Blake<eblake@redhat.com>

Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Eric Blake Sept. 24, 2021, 7:19 p.m. UTC | #2
On Tue, Sep 14, 2021 at 05:19:42PM +0300, Vladimir Sementsov-Ogievskiy wrote:
> 07.09.2021 20:35, Eric Blake wrote:
> > The NBD protocol just relaxed the requirements on
> > NBD_OPT_LIST_META_CONTEXT:
> > 
> > https://github.com/NetworkBlockDevice/nbd/commit/13a4e33a87
> > 
> > Since listing is not stateful (unlike SET_META_CONTEXT), we don't care
> > if a client asks for meta contexts without first requesting structured
> > replies.  Well-behaved clients will still ask for structured reply
> > first (if for no other reason than for back-compat to older servers),
> > but that's no reason to avoid this change.
> > 
> > Signed-off-by: Eric Blake<eblake@redhat.com>
> 
> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

Thanks; queuing this one through my NBD tree.
diff mbox series

Patch

diff --git a/nbd/server.c b/nbd/server.c
index 1646796a4798..bd635cf8ffd1 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -980,7 +980,7 @@  static int nbd_negotiate_meta_queries(NBDClient *client,
     size_t i;
     size_t count = 0;

-    if (!client->structured_reply) {
+    if (client->opt == NBD_OPT_SET_META_CONTEXT && !client->structured_reply) {
         return nbd_opt_invalid(client, errp,
                                "request option '%s' when structured reply "
                                "is not negotiated",