diff mbox

[PULL,v3,00/30] Misc patches for 2016-10-31

Message ID f5a4c0b1-4396-fd88-6006-0ab3af397a11@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Eric Blake Nov. 7, 2016, 7:26 p.m. UTC
On 11/04/2016 05:02 PM, Max Reitz wrote:

>>       nbd: Let client skip portions of server reply
> 
> This patch (7d3123e1775) breaks iotest 083 (it hangs somewhere).

Adding this breaks the infinite loop:


but then fails the assertion, which means read_sync() is returning 0 in
our particular test (which sort of makes sense: the test is purposefully
truncating the server stream at various points to see how the client
reacts).  I'm trying to figure out if always treating early EOF as a
read error would be sufficient to make things work the way we want in
the client.

Comments

Paolo Bonzini Nov. 9, 2016, 12:13 p.m. UTC | #1
> but then fails the assertion, which means read_sync() is returning 0 in
> our particular test (which sort of makes sense: the test is purposefully
> truncating the server stream at various points to see how the client
> reacts).  I'm trying to figure out if always treating early EOF as a
> read error would be sufficient to make things work the way we want in
> the client.

Yeah, early EOF should become ESHUTDOWN, ECONNRESET or similar.

Paolo
diff mbox

Patch

diff --git i/nbd/client.c w/nbd/client.c
index 5d94e34..23ad4f1 100644
--- i/nbd/client.c
+++ w/nbd/client.c
@@ -87,10 +87,11 @@  static ssize_t drop_sync(QIOChannel *ioc, size_t size)
     while (size > 0) {
         ret = read_sync(ioc, buffer, MIN(65536, size));
         if (ret < 0) {
             goto cleanup;
         }
+        assert(ret);
         assert(ret <= size);
         size -= ret;
     }
     ret = dropped;