After examining each filter and where it appears that the filter
implements a cache and does not properly consider consistency across
clients for flush requests, force .can_multi_conn to return false.
In fact I believe only one filter (blocksize) needs to be updated and
all the other ones are safe.
---
filters/blocksize/blocksize.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/filters/blocksize/blocksize.c b/filters/blocksize/blocksize.c
index 34f58c9..9e0e713 100644
--- a/filters/blocksize/blocksize.c
+++ b/filters/blocksize/blocksize.c
@@ -164,6 +164,17 @@ blocksize_get_size (struct nbdkit_next_ops *next_ops, void *nxdata,
return size == -1 ? size : size & ~(minblock - 1);
}
+static int
+blocksize_can_multi_conn (struct nbdkit_next_ops *next_ops, void *nxdata,
+ void *handle)
+{
+ /* Although we are serializing all requests anyway so this likely
+ * doesn't make a difference, return false because the bounce buffer
+ * is not consistent for flush.
+ */
+ return 0;
+}
+
static int
blocksize_pread (struct nbdkit_next_ops *next_ops, void *nxdata,
void *handle, void *b, uint32_t count, uint64_t offs,
@@ -370,6 +381,7 @@ static struct nbdkit_filter filter = {
.config_help = blocksize_config_help,
.prepare = blocksize_prepare,
.get_size = blocksize_get_size,
+ .can_multi_conn = blocksize_can_multi_conn,
.pread = blocksize_pread,
.pwrite = blocksize_pwrite,
.trim = blocksize_trim,
--
2.19.2