mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-28 22:54:05 +08:00
SUNRPC: Convert svc_udp_sendto() to use the per-socket bio_vec array
Commit da1661b93b
("SUNRPC: Teach server to use xprt_sock_sendmsg
for socket sends") modified svc_udp_sendto() to use xprt_sock_sendmsg()
because we originally believed xprt_sock_sendmsg() would be needed
for TLS support. That does not actually appear to be the case.
In addition, the linkage between the client and server send code has
been a bit of a maintenance headache because of the distinct ways
that the client and server handle memory allocation.
Going forward, eventually the XDR layer will deal with its buffers
in the form of bio_vec arrays, so convert this function accordingly.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
This commit is contained in:
parent
e18e157bb5
commit
baabf59c24
@ -693,9 +693,10 @@ static int svc_udp_sendto(struct svc_rqst *rqstp)
|
||||
.msg_name = &rqstp->rq_addr,
|
||||
.msg_namelen = rqstp->rq_addrlen,
|
||||
.msg_control = cmh,
|
||||
.msg_flags = MSG_SPLICE_PAGES,
|
||||
.msg_controllen = sizeof(buffer),
|
||||
};
|
||||
unsigned int sent;
|
||||
unsigned int count;
|
||||
int err;
|
||||
|
||||
svc_udp_release_ctxt(xprt, rqstp->rq_xprt_ctxt);
|
||||
@ -708,22 +709,23 @@ static int svc_udp_sendto(struct svc_rqst *rqstp)
|
||||
if (svc_xprt_is_dead(xprt))
|
||||
goto out_notconn;
|
||||
|
||||
err = xdr_alloc_bvec(xdr, GFP_KERNEL);
|
||||
if (err < 0)
|
||||
goto out_unlock;
|
||||
count = xdr_buf_to_bvec(rqstp->rq_bvec,
|
||||
ARRAY_SIZE(rqstp->rq_bvec), xdr);
|
||||
|
||||
err = xprt_sock_sendmsg(svsk->sk_sock, &msg, xdr, 0, 0, &sent);
|
||||
iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, rqstp->rq_bvec,
|
||||
count, 0);
|
||||
err = sock_sendmsg(svsk->sk_sock, &msg);
|
||||
if (err == -ECONNREFUSED) {
|
||||
/* ICMP error on earlier request. */
|
||||
err = xprt_sock_sendmsg(svsk->sk_sock, &msg, xdr, 0, 0, &sent);
|
||||
iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, rqstp->rq_bvec,
|
||||
count, 0);
|
||||
err = sock_sendmsg(svsk->sk_sock, &msg);
|
||||
}
|
||||
xdr_free_bvec(xdr);
|
||||
|
||||
trace_svcsock_udp_send(xprt, err);
|
||||
out_unlock:
|
||||
|
||||
mutex_unlock(&xprt->xpt_mutex);
|
||||
if (err < 0)
|
||||
return err;
|
||||
return sent;
|
||||
return err;
|
||||
|
||||
out_notconn:
|
||||
mutex_unlock(&xprt->xpt_mutex);
|
||||
|
Loading…
Reference in New Issue
Block a user