Commit 1ea26554 authored by Eric Blake's avatar Eric Blake
Browse files

api: Fix opt_mode assertion failure with SR disabled

When nbd_set_opt_mode() is enabled, we want nbd_connect_* to drop into
the NEGOTIATING state as soon as we are done with the
OPT_STRUCTURED_REPLY state machine.  But we missed a path: if
nbd_set_request_structured_replies() skips the SR probe, we ended up
moving into OPT_META_CONTEXT.START and then triggering a subsequent
assertion failure:

$ nbdsh --opt-mode -c 'h.set_request_structured_replies(False)' \
  -c 'h.connect_command(["nbdkit", "-s", "memory", "1"])'
nbdsh: generator/states-newstyle-opt-go.c:34: enter_STATE_NEWSTYLE_OPT_GO_START: Assertion `!h->opt_mode' failed.

Improve comments that I found confusing while figuring out where the
fix should go.

Fixes: 9c6fecaa ("api: Add nbd_opt_abort and nbd_aio_opt_abort", v1.3.12)
parent 9e5bf05a
Pipeline #621810878 failed with stage
in 20 minutes and 37 seconds
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment