diff mbox series

[v1,2/3] SUNRPC: Remove naked ->xpo_release_rqst from svc_send()

Message ID 20200407191101.24045.10662.stgit@klimt.1015granger.net (mailing list archive)
State Not Applicable
Headers show
Series NFS/RDMA server fixes for 5.7-rc | expand

Commit Message

Chuck Lever III April 7, 2020, 7:11 p.m. UTC
Refactor: Instead of making two transport method calls in
svc_send(), fold the ->xpo_release_rqst call into the
->xpo_sendto method of the two transports that need this extra
behavior.

Subsequently, svcrdma, which does not want or need the extra
->xpo_release_rqst call can then use ->xpo_release_rqst properly.

This patch does not fix commit 3a88092ee319 ("svcrdma: Preserve
Receive buffer until svc_rdma_sendto"), but is a prerequisite for
the next patch, which does fix that commit.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 net/sunrpc/svc_xprt.c |    3 ---
 net/sunrpc/svcsock.c  |    4 ++++
 2 files changed, 4 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
index 92f2c08c67a5..2284ff038dad 100644
--- a/net/sunrpc/svc_xprt.c
+++ b/net/sunrpc/svc_xprt.c
@@ -908,9 +908,6 @@  int svc_send(struct svc_rqst *rqstp)
 	if (!xprt)
 		goto out;
 
-	/* release the receive skb before sending the reply */
-	xprt->xpt_ops->xpo_release_rqst(rqstp);
-
 	/* calculate over-all length */
 	xb = &rqstp->rq_res;
 	xb->len = xb->head[0].iov_len +
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 519cf9c4f8fd..023514e392b3 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -527,6 +527,8 @@  static int svc_udp_sendto(struct svc_rqst *rqstp)
 	unsigned int uninitialized_var(sent);
 	int err;
 
+	svc_release_udp_skb(rqstp);
+
 	svc_set_cmsg_data(rqstp, cmh);
 
 	err = xprt_sock_sendmsg(svsk->sk_sock, &msg, xdr, 0, 0, &sent);
@@ -1076,6 +1078,8 @@  static int svc_tcp_sendto(struct svc_rqst *rqstp)
 	unsigned int uninitialized_var(sent);
 	int err;
 
+	svc_release_skb(rqstp);
+
 	err = xprt_sock_sendmsg(svsk->sk_sock, &msg, xdr, 0, marker, &sent);
 	xdr_free_bvec(xdr);
 	if (err < 0 || sent != (xdr->len + sizeof(marker)))