Since NBD_OPT_LIST_META_CONTEXTS is stateless from the server's point of view, there is no reason to make it clear state on the client's side. Since we do not otherwise modify h->meta_contexts while processing nbd_opt_list_meta_contexts(), we also should not wipe it; similarly, while clearing h->exportsize makes sense if we know we are going to attempt NBD_OPT_INFO or NBD_OPT_GO, it should not be attempted merely because we are doing NBD_OPT_LIST_META_CONTEXTS.
Testsuite coverage for this is in the next patch, for ease of review (that is, this is one case where it is easy to swap the patch order to see a failure fixed by this patch). --- generator/states-newstyle-opt-meta-context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generator/states-newstyle-opt-meta-context.c b/generator/states-newstyle-opt-meta-context.c index 35d3cbc..a281b05 100644 --- a/generator/states-newstyle-opt-meta-context.c +++ b/generator/states-newstyle-opt-meta-context.c @@ -28,7 +28,6 @@ STATE_MACHINE { * contexts, when doing SET (but an empty LIST is okay). */ assert (h->gflags & LIBNBD_HANDSHAKE_FLAG_FIXED_NEWSTYLE); - nbd_internal_reset_size_and_flags (h); if (h->opt_current == NBD_OPT_LIST_META_CONTEXT) { assert (h->opt_mode); assert (CALLBACK_IS_NOT_NULL (h->opt_cb.fn.context)); @@ -37,6 +36,7 @@ STATE_MACHINE { else { assert (CALLBACK_IS_NULL (h->opt_cb.fn.context)); opt = NBD_OPT_SET_META_CONTEXT; + nbd_internal_reset_size_and_flags (h); if (h->request_meta) { for (i = 0; i < h->meta_contexts.len; ++i) free (h->meta_contexts.ptr[i].name); -- 2.37.2 _______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://listman.redhat.com/mailman/listinfo/libguestfs