RxRPC: Fix the conversion to iov_iter
authorDavid Howells <dhowells@redhat.com>
Wed, 1 Apr 2015 13:06:00 +0000 (14:06 +0100)
committerDavid Howells <dhowells@redhat.com>
Wed, 1 Apr 2015 13:06:00 +0000 (14:06 +0100)
This commit:

commit af2b040e470b470bfc881981db3c796072853eae
Author: Al Viro <viro@zeniv.linux.org.uk>
Date:   Thu Nov 27 21:44:24 2014 -0500
Subject: rxrpc: switch rxrpc_send_data() to iov_iter primitives

incorrectly changes a do-while loop into a while loop in rxrpc_send_data().

Unfortunately, at least one pass through the loop is required - even if
there is no data - so that the packet the closes the send phase can be
sent if MSG_MORE is not set.

Signed-off-by: David Howells <dhowells@redhat.com>
net/rxrpc/ar-output.c

index 8331c95e152283d437b3dee9205cf37c9ce06271..833a33b5c1809da92696343fb362a6e86465aca9 100644 (file)
@@ -548,7 +548,7 @@ static int rxrpc_send_data(struct kiocb *iocb,
        copied = 0;
        if (len > iov_iter_count(&msg->msg_iter))
                len = iov_iter_count(&msg->msg_iter);
-       while (len) {
+       do {
                int copy;
 
                if (!skb) {
@@ -689,7 +689,7 @@ static int rxrpc_send_data(struct kiocb *iocb,
                        rxrpc_queue_packet(call, skb, !iov_iter_count(&msg->msg_iter) && !more);
                        skb = NULL;
                }
-       }
+       } while (len > 0);
 
 success:
        ret = copied;