On 9/30/19 10:17 PM, Eric Blake wrote:
After a retry, if the second connection has fewer permissions than
the
first, but we blindly call next_ops->FOO, we end up triggering an
assertion failure in backend.c. This is particularly noticeable when
the force_readonly flag is in effect, as that makes it much easier for
there to be fewer permissions than before.
Add testsuite coverage of pwrite to demonstrate.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
filters/retry/retry.c | 58 ++++++++++++++++++++++++++++++++++++++-----
1 file changed, 52 insertions(+), 6 deletions(-)
@@ -307,7 +348,12 @@ retry_cache (struct nbdkit_next_ops *next_ops,
void *nxdata,
int r;
again:
- r = next_ops->cache (nxdata, count, offset, flags, err);
+ if (next_ops->can_cache (nxdata) != 1) {
This actually needs to be <= NBDKIT_CACHE_NONE (otherwise, it penalizes
a change between EMULATE and NATIVE).
I'm also suspecting that I'll have to check can_fua and can_fast_zero
for proper usage, but that will be a followup patch.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization:
qemu.org |
libvirt.org