I've been working on this one for a while, and finally got it working well enough to post. I'm probably still going to work on adding another unit test proving that you can open multiple NBD clients in parallel, and that they can interleave I/O, but my immediate test was setting up: nbdkit -f --filter=ext2 --filter=exportname file tests/ext2.img \ ext2file=exportname exportname-list=explicit exportname=hidden then running two simultaneous nbdsh, one visiting nbd://localhost:10809/manifest and the other nbd://localhost:10809/disks/disk.img. Pre-series, the second nbdsh stalls until the first exits, post-series, both can read their respective file out of the overall image at the same time. Eric Blake (5): filters: Tighter rules on .get_ready/.after_fork threadlocal: Add way to store current context filters: Allow nbdkit_next_context_open outside client connection api: Add .cleanup callback ext2: Support parallel requests and connections docs/nbdkit-filter.pod | 65 ++++++-- docs/nbdkit-plugin.pod | 33 +++- include/nbdkit-filter.h | 10 +- include/nbdkit-plugin.h | 4 +- server/internal.h | 14 +- server/backend.c | 48 +++++- server/filters.c | 49 +++--- server/main.c | 1 + server/plugins.c | 32 ++-- server/protocol-handshake.c | 2 +- server/public.c | 24 ++- server/test-public.c | 12 +- server/threadlocal.c | 36 ++++- filters/exitwhen/exitwhen.c | 9 +- filters/ext2/ext2.c | 225 ++++++++++++++++------------ filters/extentlist/extentlist.c | 5 +- filters/log/log.c | 9 +- filters/multi-conn/multi-conn.c | 5 +- filters/pause/pause.c | 4 +- filters/rate/rate.c | 5 +- filters/retry/retry.c | 2 +- filters/stats/stats.c | 5 +- filters/tls-fallback/tls-fallback.c | 5 +- tests/test-layers-filter.c | 22 ++- tests/test-layers-plugin.c | 9 +- tests/test-layers.c | 42 ++++-- 26 files changed, 453 insertions(+), 224 deletions(-) -- 2.31.1