[Libguestfs] [PATCH nbdkit 0/7] server: Implement NBD_FLAG_CAN_MULTI_CONN.

Richard W.M. Jones rjones at redhat.com
Fri Jan 4 22:08:33 UTC 2019


First thing to say is that I need to do a *lot* more testing on this,
so this is just an early peek.  In particular, although it passed
‘make check && make check-valgrind’ I have *not* tested it against a
multi-conn-aware client such as the Linux kernel >= 4.9.

This implements NBD_FLAG_CAN_MULTI_CONN, described in the protocol doc
as:

  "NBD_FLAG_CAN_MULTI_CONN: Indicates that the server operates
  entirely without cache, or that the cache it uses is shared among
  all connections to the given device. In particular, if this flag is
  present, then the effects of NBD_CMD_FLUSH and NBD_CMD_FLAG_FUA MUST
  be visible across all connections when the server sends its reply to
  that command to the client. In the absence of this flag, clients
  SHOULD NOT multiplex their commands over more than one connection to
  the export."

This is necessary to support the Linux nbd client -C option.

The only plugin which sets the flag so far is file.  The ocaml, sh and
nbd plugins allow the flag to be controlled or passed through.

Notable also is that the blocksize filter has to filter out this flag,
because I'm not convinced that the bounce buffer is safe.  However I
believe the other filters *are* safe (although not really certain
about the fua filter, and the new cache filter is tricky too).

My feeling is that we should set the flag unconditionally for all
readonly connections, but I can think of nasty corner cases where it
might not work.  We should most probably set it in all plugins that
are readonly (eg. nbdkit-pattern-plugin).

Rich.





More information about the Libguestfs mailing list