nbdkit-multi-conn-filter(1)
π¦ nbdkit-multi-conn-filter π¦
okay bestie, this is the nbdkit-multi-conn-filter page from the NBDKIT manual, and it's genuinely one of the most "trust me bro, it's about consistency" filters in the whole toolkit. let's get into it π
β¨ NAME β¨
nbdkit-multi-conn-filter β enable, emulate or disable multi-conn
πΈ SYNOPSIS πΈ
nbdkit --filter=multi-conn plugin
[multi-conn-mode=MODE] [multi-conn-track-dirty=LEVEL]
[multi-conn-exportname=BOOL]
[plugin-args...]
π DESCRIPTION π
so NBD_FLAG_CAN_MULTI_CONN (aka "multi-conn", ikyk) is an NBD protocol feature that lets multiple clients connect to the same export at the same time, and it guarantees flush operations are consistent across those connections. like, specifically: if you get a write response, then send a flush and wait for the flush response, then send a read request β that whole sequence behaves exactly the same whether all three commands went down one single connection or got split across three different connections. when an NBD client and server can negotiate this, it's giving significant performance benefits β¨
and conversely, if the feature is not advertised, clients have to presume that separate connections can cache writes independently (so even after waiting for a flush on one connection, a read on another connection may see stale data from a cache π). the NBD standard literally advises clients not to multiplex commands across connections if the server doesn't support multi-conn.
nbdkit(1) plugins must normally opt in to multi-conn, after carefully making sure the implementation actually meets the consistency requirements. this filter can emulate flush-consistent semantics across multiple connections for plugins that don't advertise this feature. iconic.
this filter also has extra modes that are useful for evaluating performance and correctness of client and plugin multi-conn behaviors π₯
β οΈ this filter assumes that multiple connections to a plugin will eventually share data, other than any caching effects. it is not suitable for use with a plugin that produces completely independent data per connection from the same export name. an example of a plugin that must not be used with this filter is nbdkit-tmpdisk-plugin(1). no cap, don't do it π
additional control over the behavior of client flush commands is possible by combining this filter with nbdkit-fua-filter(1). also note that nbdkit-cache-filter(1) is also able to provide multi-connection flush consistency, but at the expense of an extra layer of caching that isn't needed with this filter.
π PARAMETERS π
multi-conn-mode=autoβ this is the default mode. the behaviour ofautois as follows:- if the selected thread model is
SERIALIZE_CONNECTIONS, then this filter behaves the same asdisablemode. - if the plugin advertises multi-conn, then this filter behaves the same as
pluginmode. - otherwise, this filter behaves the same as
emulatemode.
- if the selected thread model is
in other words, this mode advertises multi-conn to the client exactly when the plugin supports, or can be made to support, multiple simultaneous connections. π
multi-conn-mode=emulateβ whenemulatemode is chosen, this filter tracks all parallel connections. when a client issues a flush command over any one connection (including an implied flush by a write command with the FUA (force unit access) flag set), the filter then replicates that flush across each connection to the plugin. the number of plugin calls made by the filter can be tuned by adjustingmulti-conn-track-dirty.
this mode assumes that flushing each connection is enough to clear any per-connection cached data, in order to give each connection a consistent view of the image; therefore, this mode advertises multi-conn to the client.
note that in this mode, a client will be unable to connect if the plugin lacks support for flush, because there'd be no way to emulate cross-connection flush consistency. π
multi-conn-mode=disableβ whendisablemode is chosen, this filter disables advertisement of multi-conn to the client, even if the plugin supports it, and does not replicate flush commands across connections. this is useful for testing whether a client with multiple connections properly sends multiple flushes in order to overcome per-connection caching. π§multi-conn-mode=pluginβ whenpluginmode is chosen, the filter does not change whether multi-conn is advertised by the plugin, and does not replicate flush commands across connections; but it still honorsmulti-conn-track-dirtyfor minimizing the number of flush commands passed on to the plugin.multi-conn-mode=unsafeβ whenunsafemode is chosen, this filter blindly advertises multi-conn to the client even if the plugin lacks support. this is dangerous, and risks data corruption if the client makes assumptions about flush consistency that the plugin does not actually provide. however, for a plugin that doesn't yet advertise multi-conn, but where it's suspected that the plugin behaves consistently, this is a great way to run timing and accuracy tests to see whether enabling multi-conn in the plugin will make a difference. πmulti-conn-track-dirty=fastβ when dirty tracking is set tofast, the filter tracks whether any connection has caused the image to be dirty (any write, zero, or trim commands since the last flush, regardless of connection); if all connections are clean, a client flush command is ignored rather than sent on to the plugin. in this mode, a flush action on one connection marks all other connections as clean, regardless of whether the filter actually advertised multi-conn, which can result in less activity when a client sends multiple flushes rather than taking advantage of multi-conn semantics. this is safe withmulti-conn-mode=emulate, but potentially unsafe withmulti-conn-mode=pluginwhen the plugin did not advertise multi-conn, as it does not track whether a read may have cached stale data prior to a flush. πmulti-conn-track-dirty=connectionβ this is the default setting formulti-conn-track-dirty.
the filter tracks whether a given connection is dirty (any write, zero, or trim commands since the last flush on the given connection, and any read since the last flush on any other connection); if the connection is clean, a flush command to that connection (whether directly from the client, or replicated by multi-conn-mode=emulate is ignored rather than sent on to the plugin. this mode may result in more flush calls than multi-conn-track-dirty=fast, but in turn is safe to use with multi-conn-mode=plugin.
multi-conn-track-dirty=offβ when dirty tracking is set tooff, all flush commands from the client are passed on to the plugin, regardless of whether the flush would be needed for cross-connection consistency. note that when combined withmulti-conn-mode=emulate, a client which disregards multi-conn by flushing on each connection itself results in a quadratic number of flush operations on the plugin. π not the quadratic blowup bestiemulti-conn-exportname=falseβ the exportname switch defaults tofalsefor safety, and causes the filter to flush across all active connections regardless of the export name in use by that connection when doing emulation. however, when a plugin supports distinct data according to export name, this behavior will penalize the performance of clients visiting an unrelated export by spending time on replicated flush operations that aren't actually relevant to that export.multi-conn-exportname=trueβ setting the exportname switch totruecauses the filter to only synchronize flushes to connections visiting the same export name. this avoids penalizing clients visiting an unrelated export name (such asnbdkit-file-plugin(1)indir=mode), but is unsafe when used with a plugin that serves shared content across all connections regardless of the export name requested by the client, if that plugin is not already multi-conn consistent (such asnbdkit-vddk-plugin(1)). π¨
π EXAMPLES π
provide consistent cross-connection flush semantics on top of a plugin that lacks it natively:
nbdkit --filter=multi-conn vddk /absolute/path/to/file.vmdk
minimize the number of expensive flush operations performed when utilizing a plugin that has multi-conn consistency from a client that blindly flushes across every connection:
nbdkit --filter=multi-conn file multi-conn-mode=plugin \
multi-conn-track-dirty=fast disk.img
π FILES π
$filterdir/nbdkit-multi-conn-filter.soβ the filter. π«Ά
use nbdkit --dump-config to find the location of $filterdir.
β VERSION β
nbdkit-multi-conn-filter first appeared in nbdkit 1.26. periodt.
π SEE ALSO π
nbdkit(1), nbdkit-file-plugin(1), nbdkit-vddk-plugin(1), nbdkit-filter(3), nbdkit-cache-filter(1), nbdkit-fua-filter(1), nbdkit-nocache-filter(1), nbdkit-noextents-filter(1), nbdkit-noparallel-filter(1), nbdkit-nozero-filter(1), nbdkit-openonce-filter(1), https://github.com/NetworkBlockDevice/nbd/blob/master/doc/proto.md
π AUTHORS π
Eric Blake β the main character, honestly.
πΈ COPYRIGHT πΈ
Copyright Red Hat
π LICENSE π
redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- neither the name of Red Hat nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
and that's the whole page bestie!! π this version came from nbdkit-1.48.1, dated 2026-08-29, and it's the nbdkit-multi-conn-filter(1) page β go forth and be flush-consistent, ily, slay π¦β¨
π¦ where this page comes from
- fedora 44: nbdkit-basic-filters 1.48.1-1.fc44 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms