Commit cd22c8c9 authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] Only set dest addr in NFS/udp reply, not NFS/tcp.

We don't need to send an empty message to
set up remote address when sending tcp reply, so
we don't.  Also, as the data is empty, we don't
need to set_fs.
parent e063af97
......@@ -324,10 +324,8 @@ svc_wake_up(struct svc_serv *serv)
static int
svc_sendto(struct svc_rqst *rqstp, struct xdr_buf *xdr)
{
mm_segment_t oldfs;
struct svc_sock *svsk = rqstp->rq_sock;
struct socket *sock = svsk->sk_sock;
struct msghdr msg;
int slen;
int len = 0;
int result;
......@@ -339,6 +337,12 @@ svc_sendto(struct svc_rqst *rqstp, struct xdr_buf *xdr)
slen = xdr->len;
/* Grab svsk->sk_sem to serialize outgoing data. */
down(&svsk->sk_sem);
if (rqstp->rq_prot == IPPROTO_UDP) {
/* set the destination */
struct msghdr msg;
msg.msg_name = &rqstp->rq_addr;
msg.msg_namelen = sizeof(rqstp->rq_addr);
msg.msg_iov = NULL;
......@@ -347,15 +351,9 @@ svc_sendto(struct svc_rqst *rqstp, struct xdr_buf *xdr)
msg.msg_controllen = 0;
msg.msg_flags = MSG_MORE;
/* Grab svsk->sk_sem to serialize outgoing data. */
down(&svsk->sk_sem);
/* set the destination */
oldfs = get_fs(); set_fs(KERNEL_DS);
len = sock_sendmsg(sock, &msg, 0);
set_fs(oldfs);
if (len < 0)
if (sock_sendmsg(sock, &msg, 0) < 0)
goto out;
}
/* send head */
if (slen == xdr->head[0].iov_len)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment