From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 413FB2F8E9E for ; Tue, 6 Oct 2026 13:31:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791293477; cv=none; b=d991gIVvdAQwDydBdiwWqOclxRiuS9r8jd0nAIEjf6Bp1eZRpQQ5SCNXNgU8CEN6awJcBUgpJbVej5obkqEKN+pEzGqQ9yEWrRoX6ikJhiN8Xgjpxvx5P5tkQ+KDW448Tv4SdnYomi39cbPF/seNPy+tVv4atX+u8a2Hx7G0j78= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791293477; c=relaxed/simple; bh=zURKiM1M4tOxL8/zobk0WfEL3mo01JvJJDe9z4Bajqw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gfHIdrZyQ15zuz+MD3dwO5aBphoupH5Ye8E3fQ3KKoD3ZBuSaumhX6m3bFlLxNxOj8Ria9xeYQkZlThYfZrJGM0O7fgEMcOXFl4qG+0FhZ+uEJVUzuuXGvUcCky8uj/WHsRy7OpDwMbL9u4BFNukWs/bLb3W/Wm4OwAZM9GBnBU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=LmMBNPpk; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="LmMBNPpk" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1791293471; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wlqh1NSLDC0mwQNsbf6k8N136eyzqEjnSpXcO+8T0/4=; b=LmMBNPpkWwz2k4GPI2MEmaToNZO37i2u0By0JRwK7TehBvHt2ixDC8FI23UnU6FLvsDibI b1n30GYm4SSJBxUYEVcL8BHlITi/Ymp6hIGuRvD3RC8QZmPWKFexUSbTn6LDbcE+4IJiXZ qYtUYf7o6nM7yG4VPf8axlCDSeG47RY= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-93-gS_PrtnLPrWZKKMongjL2A-1; Tue, 06 Oct 2026 09:31:08 -0400 X-MC-Unique: gS_PrtnLPrWZKKMongjL2A-1 X-Mimecast-MFC-AGG-ID: gS_PrtnLPrWZKKMongjL2A_1791293465 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id ADF251935D32; Tue, 6 Oct 2026 13:31:05 +0000 (UTC) Received: from warthog.com (unknown [10.44.32.90]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 319881800345; Tue, 6 Oct 2026 13:31:01 +0000 (UTC) From: David Howells To: netdev@vger.kernel.org Cc: David Howells , Marc Dionne , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Simon Horman , linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org, Jeffrey Altman , stable@vger.kernel.org Subject: [PATCH net v12 09/15] rxrpc: Fix return in rxrpc_recvmsg_data() for service calls Date: Tue, 6 Oct 2026 14:30:01 +0100 Message-ID: <20261006133011.531806-10-dhowells@redhat.com> In-Reply-To: <20261006133011.531806-1-dhowells@redhat.com> References: <20261006133011.531806-1-dhowells@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 When rxrpc_recvmsg_data() gets called on a service call that has received all of the request, RXRPC_CALL_RECVMSG_READ_ALL has been set, and this causes rxrpc_recvmsg_data() to jump straight out, indicating the end of the call (ie. rxrpc_kernel_recv_data() returns 1) without waiting for the call to be processed or the reply to be transmitted. rxperf_deliver_to_call() also has to be altered to call rxrpc_kernel_recv_data() to collect the final ACK on a service call as does afs_deliver_to_call(). Fixes: d001648ec7cf ("rxrpc: Don't expose skbs to in-kernel users [ver #2]") Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260914151340.3227501-1-dhowells%40redhat.com Signed-off-by: David Howells cc: Marc Dionne cc: Jeffrey Altman cc: Eric Dumazet cc: "David S. Miller" cc: Jakub Kicinski cc: Paolo Abeni cc: Simon Horman cc: linux-afs@lists.infradead.org cc: stable@vger.kernel.org --- Documentation/networking/rxrpc.rst | 13 +++++++++---- fs/afs/rxrpc.c | 4 ++-- net/rxrpc/recvmsg.c | 13 ++++++++++--- net/rxrpc/rxperf.c | 16 ++++++++++++++-- 4 files changed, 35 insertions(+), 11 deletions(-) diff --git a/Documentation/networking/rxrpc.rst b/Documentation/networking/rxrpc.rst index 9239f7bd8885..eca055a536aa 100644 --- a/Documentation/networking/rxrpc.rst +++ b/Documentation/networking/rxrpc.rst @@ -909,10 +909,15 @@ The kernel interface functions are as follows: want_more should be true if further data will be required after this is satisfied and false if this is the last item of the receive phase. - There are three normal returns: 0 if the buffer was filled and want_more - was true; 1 if the buffer was filled, the last DATA packet has been - emptied and want_more was false; and -EAGAIN if the function needs to be - called again. + For client calls, there are three normal returns: 0 if the buffer was + filled and want_more was true; 1 if the buffer was filled, the last DATA + packet has been emptied and want_more was false; and -EAGAIN if the + function needs to be called again. + + For service calls, there are four normal returns: 0 and -EAGAIN are the + same as for client calls; 2 indicates that the last DATA packet of the + request has been received, want_more was false and the call is still in + progress; and 1 indicates that the call is now successfully complete. If the last DATA packet is processed but the buffer contains less than the amount requested, EBADMSG is returned. If want_more wasn't set, but diff --git a/fs/afs/rxrpc.c b/fs/afs/rxrpc.c index 64dd32df8a34..768b26820dea 100644 --- a/fs/afs/rxrpc.c +++ b/fs/afs/rxrpc.c @@ -541,7 +541,7 @@ void afs_deliver_to_call(struct afs_call *call) &call->service_id); trace_afs_receive_data(call, &call->def_iter, false, ret); - if (ret == -EINPROGRESS || ret == -EAGAIN) + if (ret == -EAGAIN || ret == 2) return; if (ret < 0 || ret == 1) { if (ret == 1) @@ -934,7 +934,7 @@ int afs_extract_data(struct afs_call *call, bool want_more) return ret; state = READ_ONCE(call->state); - if (ret == 1) { + if (ret == 1 || ret == 2) { switch (state) { case AFS_CALL_CL_AWAIT_REPLY: afs_set_call_state(call, state, AFS_CALL_CL_PROC_REPLY); diff --git a/net/rxrpc/recvmsg.c b/net/rxrpc/recvmsg.c index 56fa324d0962..0c960f13b5fc 100644 --- a/net/rxrpc/recvmsg.c +++ b/net/rxrpc/recvmsg.c @@ -638,9 +638,11 @@ int rxrpc_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, * Note that we may return %-EAGAIN to drain empty packets at the end * of the data, even if we've already copied over the requested data. * - * Return: %0 if got what was asked for and there's more available, %1 - * if we got what was asked for and we're at the end of the data and - * %-EAGAIN if we need more data. + * Return: %0 if got what was asked for and there's more available, %1 if we + * got what was asked for and we're at the end of the call, %2 if a service + * call received all of the request but is still in progress and %-EAGAIN if we + * need more data. A variety of other errors can be returned if the call + * completed with failure. */ int rxrpc_kernel_recv_data(struct socket *sock, struct rxrpc_call *call, struct iov_iter *iter, size_t *_len, @@ -679,6 +681,11 @@ int rxrpc_kernel_recv_data(struct socket *sock, struct rxrpc_call *call, read_phase_complete: ret = 1; + if (rxrpc_is_service_call(call)) { + if (rxrpc_call_is_complete(call)) + goto call_failed; + ret = 2; + } out: if (_service) *_service = call->dest_srx.srx_service; diff --git a/net/rxrpc/rxperf.c b/net/rxrpc/rxperf.c index 823eedc5d16f..0bc3de061b93 100644 --- a/net/rxrpc/rxperf.c +++ b/net/rxrpc/rxperf.c @@ -293,8 +293,20 @@ static void rxperf_deliver_to_call(struct work_struct *work) state == RXPERF_CALL_SV_AWAIT_ACK ) { if (state == RXPERF_CALL_SV_AWAIT_ACK) { - if (!rxrpc_kernel_check_life(rxperf_socket, call->rxcall)) + size_t len = 0; + iov_iter_kvec(&call->iter, ITER_DEST, NULL, 0, 0); + ret = rxrpc_kernel_recv_data(rxperf_socket, + call->rxcall, &call->iter, + &len, false, &remote_abort, + &call->service_id); + + if (ret == -EAGAIN || ret == 2) + return; + if (ret < 0 || ret == 1) { + if (ret == 1) + ret = 0; goto call_complete; + } return; } @@ -369,7 +381,7 @@ static int rxperf_extract_data(struct rxperf_call *call, bool want_more) if (ret == 0 || ret == -EAGAIN) return ret; - if (ret == 1) { + if (ret == 1 || ret == 2) { switch (call->state) { case RXPERF_CALL_SV_AWAIT_REQUEST: rxperf_set_call_state(call, RXPERF_CALL_SV_REPLYING);