Upstream NBD clarified (see NBD commit 13a4e33a8) that since
NBD_OPT_LIST_META_CONTEXT is stateless on the server side, it is
acceptable (but not mandatory) for servers to accept it without the
client having pre-negotiated structured replies. We aren't quite
stateless on the client side yet - that will be fixed in a later patch
to keep this one small and easier to test. The test is in the next
patch, to make it easier to temporarily reorder the series to see that
it catches the problem.
---
generator/states-newstyle-opt-meta-context.c | 4 +---
lib/opt.c | 6 +-----
2 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/generator/states-newstyle-opt-meta-context.c
b/generator/states-newstyle-opt-meta-context.c
index 84dbcd69..bfc51eb4 100644
--- a/generator/states-newstyle-opt-meta-context.c
+++ b/generator/states-newstyle-opt-meta-context.c
@@ -33,7 +33,7 @@ NEWSTYLE.OPT_META_CONTEXT.START:
* nbd_opt_go()
* -> conditionally use SET, next state OPT_GO for NBD_OPT_GO
* nbd_opt_list_meta_context()
- * -> conditionally use LIST, next state NEGOTIATING
+ * -> unconditionally use LIST, next state NEGOTIATING
*
* For now, we start by unconditionally clearing h->exportsize and friends,
* as well as h->meta_contexts and h->meta_valid.
@@ -42,7 +42,6 @@ NEWSTYLE.OPT_META_CONTEXT.START:
* SET then manipulates h->meta_contexts, and sets h->meta_valid on success.
* If OPT_GO is later successful, it populates h->exportsize and friends,
* and also sets h->meta_valid if we skipped SET here.
- * LIST is conditional, skipped if structured replies were not negotiated.
* There is a callback if and only if the command is LIST.
*/
assert (h->gflags & LIBNBD_HANDSHAKE_FLAG_FIXED_NEWSTYLE);
@@ -52,7 +51,6 @@ NEWSTYLE.OPT_META_CONTEXT.START:
meta_vector_reset (&h->meta_contexts);
if (h->opt_current == NBD_OPT_LIST_META_CONTEXT) {
assert (h->opt_mode);
- assert (h->structured_replies);
assert (CALLBACK_IS_NOT_NULL (h->opt_cb.fn.context));
opt = h->opt_current;
}
diff --git a/lib/opt.c b/lib/opt.c
index e5802f4d..d9114f4b 100644
--- a/lib/opt.c
+++ b/lib/opt.c
@@ -1,5 +1,5 @@
/* NBD client library in userspace
- * Copyright (C) 2020-2021 Red Hat Inc.
+ * Copyright (C) 2020-2022 Red Hat Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -290,10 +290,6 @@ nbd_unlocked_aio_opt_list_meta_context (struct nbd_handle *h,
set_error (ENOTSUP, "server is not using fixed newstyle protocol");
return -1;
}
- if (!h->structured_replies) {
- set_error (ENOTSUP, "server lacks structured replies");
- return -1;
- }
assert (CALLBACK_IS_NULL (h->opt_cb.fn.context));
h->opt_cb.fn.context = *context;
--
2.37.3