[Libguestfs] [PATCH nbdkit v2 0/4] Add new retry filter.

Richard W.M. Jones rjones at redhat.com
Thu Sep 19 14:49:31 UTC 2019


There's still one problem in this patch.  It's not revealed by the
test but you can reproduce it using an SSH download:

1. Start the SSH download.

2. On remote server do: systemctl stop sshd

3. During the download kill sshd associated with the transfer.

The retry filter will detect the failure in (eg) pread, and start the
retry process.  This calls next_ops->reopen which closes and then
reopens the SSH connection.  The SSH .open fails (because sshd cannot
be reached) and the whole download fails immediately.

As it stands it's not possible to simply retry the next_ops->reopen
because the handle will be double-closed, but we might consider
folding the change below into patch 2/4.

Before I do that I really need an automated test of this so I can
check it's really been fixed.

Rich.

diff --git a/server/backend.c b/server/backend.c
index 69a07d7..52b1734 100644
--- a/server/backend.c
+++ b/server/backend.c
@@ -236,9 +236,12 @@ backend_valid_range (struct backend *b, struct connection *conn,
 int
 backend_reopen (struct backend *b, struct connection *conn, int readonly)
 {
+  struct b_conn_handle *h = &conn->handles[b->i];
+
   debug ("%s: reopen", b->name);
 
-  backend_close (b, conn);
+  if (h->handle != NULL)
+    backend_close (b, conn);
   return backend_open (b, conn, readonly);
 }
 


-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v




More information about the Libguestfs mailing list