[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [nbdkit PATCH] cow: Always advertise multi-conn



Our cow data is locked for proper sharing across connections, so even
though NBD_CMD_FLUSH is an intentional no-op, a client is guaranteed
that after a flush by connection A, a read by connection B will not
see any stale data, which matches the requirements for always
advertising multi-conn.
---
 filters/cow/cow.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/filters/cow/cow.c b/filters/cow/cow.c
index 93e10f24..1085ee36 100644
--- a/filters/cow/cow.c
+++ b/filters/cow/cow.c
@@ -181,6 +181,14 @@ cow_can_cache (struct nbdkit_next_ops *next_ops, void *nxdata, void *handle)
   return NBDKIT_CACHE_NATIVE;
 }

+static int
+cow_can_multi_conn (struct nbdkit_next_ops *next_ops, void *nxdata,
+                    void *handle)
+{
+  /* Our cache is consistent between connections.  */
+  return 1;
+}
+
 /* Override the plugin's .can_fast_zero, because our .zero is not fast */
 static int
 cow_can_fast_zero (struct nbdkit_next_ops *next_ops, void *nxdata,
@@ -712,6 +720,7 @@ static struct nbdkit_filter filter = {
   .can_fua           = cow_can_fua,
   .can_cache         = cow_can_cache,
   .can_fast_zero     = cow_can_fast_zero,
+  .can_multi_conn    = cow_can_multi_conn,
   .pread             = cow_pread,
   .pwrite            = cow_pwrite,
   .zero              = cow_zero,
-- 
2.30.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]