Skip to contentSkip to conversation

nbd/server: Allow LIST_META_CONTEXT without STRUCTURED_REPLY

PATCH In review Eric Blake 2 participants 3 messages Sep 7, 2021 – Sep 24, 2021

lore
Share & tools
lore

Eric Blake

author
#0 lore raw

PATCH 1/1 nbd/server: Allow LIST_META_CONTEXT without STRUCTURED_REPLY

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.

---
 nbd/server.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
nbd/server.c +1 -1
index 1646796a4798..bd635cf8ffd1 100644
@@ -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",
Signature · 1 line
2.31.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Eric Blake

The NBD protocol just relaxed the requirements on
NBD_OPT_LIST_META_CONTEXT:

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

Quoted 7 lines

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.

Signature · 2 lines
Best regards,
Vladimir
author
#2 lore raw
Quoted 12 lines · Vladimir Sementsov-Ogievskiy
Quoted 11 lines · Eric Blake

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.

Quoted 3 lines
Quoted 1 line

Thanks; queuing this one through my NBD tree.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org