afs: Don't truncate iter during data fetch
Don't truncate the iterator to correspond to the actual data size when fetching the data from the server - rather, pass the length we want to read to rxrpc. This will allow the clear-after-read code in future to simply clear the remaining iterator capacity rather than having to reinitialise the iterator. Signed-off-by: David Howells <dhowells@redhat.com> Tested-By: Marc Dionne <marc.dionne@auristor.com> cc: linux-afs@lists.infradead.org cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org Link: https://lore.kernel.org/r/158861249201.340223.13035445866976590375.stgit@warthog.procyon.org.uk/ # rfc Link: https://lore.kernel.org/r/159465825061.1377938.14403904452300909320.stgit@warthog.procyon.org.uk/ Link: https://lore.kernel.org/r/160588531418.3465195.10712005940763063144.stgit@warthog.procyon.org.uk/ # rfc Link: https://lore.kernel.org/r/161118148567.1232039.13380313332292947956.stgit@warthog.procyon.org.uk/ # rfc Link: https://lore.kernel.org/r/161161044610.2537118.17908520793806837792.stgit@warthog.procyon.org.uk/ # v2 Link: https://lore.kernel.org/r/161340407907.1303470.6501394859511712746.stgit@warthog.procyon.org.uk/ # v3 Link: https://lore.kernel.org/r/161539551721.286939.14655713136572200716.stgit@warthog.procyon.org.uk/ # v4 Link: https://lore.kernel.org/r/161653807790.2770958.14034599989374173734.stgit@warthog.procyon.org.uk/ # v5 Link: https://lore.kernel.org/r/161789090823.6155.15673999934535049102.stgit@warthog.procyon.org.uk/ # v6
This commit is contained in:
@@ -669,6 +669,7 @@ wait_error:
|
||||
* @sock: The socket that the call exists on
|
||||
* @call: The call to send data through
|
||||
* @iter: The buffer to receive into
|
||||
* @_len: The amount of data we want to receive (decreased on return)
|
||||
* @want_more: True if more data is expected to be read
|
||||
* @_abort: Where the abort code is stored if -ECONNABORTED is returned
|
||||
* @_service: Where to store the actual service ID (may be upgraded)
|
||||
@@ -684,7 +685,7 @@ wait_error:
|
||||
* *_abort should also be initialised to 0.
|
||||
*/
|
||||
int rxrpc_kernel_recv_data(struct socket *sock, struct rxrpc_call *call,
|
||||
struct iov_iter *iter,
|
||||
struct iov_iter *iter, size_t *_len,
|
||||
bool want_more, u32 *_abort, u16 *_service)
|
||||
{
|
||||
size_t offset = 0;
|
||||
@@ -692,7 +693,7 @@ int rxrpc_kernel_recv_data(struct socket *sock, struct rxrpc_call *call,
|
||||
|
||||
_enter("{%d,%s},%zu,%d",
|
||||
call->debug_id, rxrpc_call_states[call->state],
|
||||
iov_iter_count(iter), want_more);
|
||||
*_len, want_more);
|
||||
|
||||
ASSERTCMP(call->state, !=, RXRPC_CALL_SERVER_SECURING);
|
||||
|
||||
@@ -703,8 +704,8 @@ int rxrpc_kernel_recv_data(struct socket *sock, struct rxrpc_call *call,
|
||||
case RXRPC_CALL_SERVER_RECV_REQUEST:
|
||||
case RXRPC_CALL_SERVER_ACK_REQUEST:
|
||||
ret = rxrpc_recvmsg_data(sock, call, NULL, iter,
|
||||
iov_iter_count(iter), 0,
|
||||
&offset);
|
||||
*_len, 0, &offset);
|
||||
*_len -= offset;
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user