aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/svcsock.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sunrpc/svcsock.c')
-rw-r--r--net/sunrpc/svcsock.c38
1 files changed, 24 insertions, 14 deletions
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index b1cb97bbbd3..157de9979cf 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -201,10 +201,12 @@ static void svc_release_skb(struct svc_rqst *rqstp)
201 struct svc_deferred_req *dr = rqstp->rq_deferred; 201 struct svc_deferred_req *dr = rqstp->rq_deferred;
202 202
203 if (skb) { 203 if (skb) {
204 struct svc_sock *svsk =
205 container_of(rqstp->rq_xprt, struct svc_sock, sk_xprt);
204 rqstp->rq_xprt_ctxt = NULL; 206 rqstp->rq_xprt_ctxt = NULL;
205 207
206 dprintk("svc: service %p, releasing skb %p\n", rqstp, skb); 208 dprintk("svc: service %p, releasing skb %p\n", rqstp, skb);
207 skb_free_datagram(rqstp->rq_sock->sk_sk, skb); 209 skb_free_datagram(svsk->sk_sk, skb);
208 } 210 }
209 if (dr) { 211 if (dr) {
210 rqstp->rq_deferred = NULL; 212 rqstp->rq_deferred = NULL;
@@ -418,7 +420,7 @@ svc_wake_up(struct svc_serv *serv)
418 dprintk("svc: daemon %p woken up.\n", rqstp); 420 dprintk("svc: daemon %p woken up.\n", rqstp);
419 /* 421 /*
420 svc_thread_dequeue(pool, rqstp); 422 svc_thread_dequeue(pool, rqstp);
421 rqstp->rq_sock = NULL; 423 rqstp->rq_xprt = NULL;
422 */ 424 */
423 wake_up(&rqstp->rq_wait); 425 wake_up(&rqstp->rq_wait);
424 } 426 }
@@ -435,7 +437,9 @@ union svc_pktinfo_u {
435 437
436static void svc_set_cmsg_data(struct svc_rqst *rqstp, struct cmsghdr *cmh) 438static void svc_set_cmsg_data(struct svc_rqst *rqstp, struct cmsghdr *cmh)
437{ 439{
438 switch (rqstp->rq_sock->sk_sk->sk_family) { 440 struct svc_sock *svsk =
441 container_of(rqstp->rq_xprt, struct svc_sock, sk_xprt);
442 switch (svsk->sk_sk->sk_family) {
439 case AF_INET: { 443 case AF_INET: {
440 struct in_pktinfo *pki = CMSG_DATA(cmh); 444 struct in_pktinfo *pki = CMSG_DATA(cmh);
441 445
@@ -468,7 +472,8 @@ static void svc_set_cmsg_data(struct svc_rqst *rqstp, struct cmsghdr *cmh)
468static int 472static int
469svc_sendto(struct svc_rqst *rqstp, struct xdr_buf *xdr) 473svc_sendto(struct svc_rqst *rqstp, struct xdr_buf *xdr)
470{ 474{
471 struct svc_sock *svsk = rqstp->rq_sock; 475 struct svc_sock *svsk =
476 container_of(rqstp->rq_xprt, struct svc_sock, sk_xprt);
472 struct socket *sock = svsk->sk_sock; 477 struct socket *sock = svsk->sk_sock;
473 int slen; 478 int slen;
474 union { 479 union {
@@ -541,7 +546,7 @@ svc_sendto(struct svc_rqst *rqstp, struct xdr_buf *xdr)
541 } 546 }
542out: 547out:
543 dprintk("svc: socket %p sendto([%p %Zu... ], %d) = %d (addr %s)\n", 548 dprintk("svc: socket %p sendto([%p %Zu... ], %d) = %d (addr %s)\n",
544 rqstp->rq_sock, xdr->head[0].iov_base, xdr->head[0].iov_len, 549 svsk, xdr->head[0].iov_base, xdr->head[0].iov_len,
545 xdr->len, len, svc_print_addr(rqstp, buf, sizeof(buf))); 550 xdr->len, len, svc_print_addr(rqstp, buf, sizeof(buf)));
546 551
547 return len; 552 return len;
@@ -617,7 +622,8 @@ svc_recv_available(struct svc_sock *svsk)
617static int 622static int
618svc_recvfrom(struct svc_rqst *rqstp, struct kvec *iov, int nr, int buflen) 623svc_recvfrom(struct svc_rqst *rqstp, struct kvec *iov, int nr, int buflen)
619{ 624{
620 struct svc_sock *svsk = rqstp->rq_sock; 625 struct svc_sock *svsk =
626 container_of(rqstp->rq_xprt, struct svc_sock, sk_xprt);
621 struct msghdr msg = { 627 struct msghdr msg = {
622 .msg_flags = MSG_DONTWAIT, 628 .msg_flags = MSG_DONTWAIT,
623 }; 629 };
@@ -707,7 +713,9 @@ svc_write_space(struct sock *sk)
707static void svc_udp_get_dest_address(struct svc_rqst *rqstp, 713static void svc_udp_get_dest_address(struct svc_rqst *rqstp,
708 struct cmsghdr *cmh) 714 struct cmsghdr *cmh)
709{ 715{
710 switch (rqstp->rq_sock->sk_sk->sk_family) { 716 struct svc_sock *svsk =
717 container_of(rqstp->rq_xprt, struct svc_sock, sk_xprt);
718 switch (svsk->sk_sk->sk_family) {
711 case AF_INET: { 719 case AF_INET: {
712 struct in_pktinfo *pki = CMSG_DATA(cmh); 720 struct in_pktinfo *pki = CMSG_DATA(cmh);
713 rqstp->rq_daddr.addr.s_addr = pki->ipi_spec_dst.s_addr; 721 rqstp->rq_daddr.addr.s_addr = pki->ipi_spec_dst.s_addr;
@@ -727,7 +735,8 @@ static void svc_udp_get_dest_address(struct svc_rqst *rqstp,
727static int 735static int
728svc_udp_recvfrom(struct svc_rqst *rqstp) 736svc_udp_recvfrom(struct svc_rqst *rqstp)
729{ 737{
730 struct svc_sock *svsk = rqstp->rq_sock; 738 struct svc_sock *svsk =
739 container_of(rqstp->rq_xprt, struct svc_sock, sk_xprt);
731 struct svc_serv *serv = svsk->sk_xprt.xpt_server; 740 struct svc_serv *serv = svsk->sk_xprt.xpt_server;
732 struct sk_buff *skb; 741 struct sk_buff *skb;
733 union { 742 union {
@@ -1109,7 +1118,8 @@ failed:
1109static int 1118static int
1110svc_tcp_recvfrom(struct svc_rqst *rqstp) 1119svc_tcp_recvfrom(struct svc_rqst *rqstp)
1111{ 1120{
1112 struct svc_sock *svsk = rqstp->rq_sock; 1121 struct svc_sock *svsk =
1122 container_of(rqstp->rq_xprt, struct svc_sock, sk_xprt);
1113 struct svc_serv *serv = svsk->sk_xprt.xpt_server; 1123 struct svc_serv *serv = svsk->sk_xprt.xpt_server;
1114 int len; 1124 int len;
1115 struct kvec *vec; 1125 struct kvec *vec;
@@ -1273,16 +1283,16 @@ svc_tcp_sendto(struct svc_rqst *rqstp)
1273 reclen = htonl(0x80000000|((xbufp->len ) - 4)); 1283 reclen = htonl(0x80000000|((xbufp->len ) - 4));
1274 memcpy(xbufp->head[0].iov_base, &reclen, 4); 1284 memcpy(xbufp->head[0].iov_base, &reclen, 4);
1275 1285
1276 if (test_bit(XPT_DEAD, &rqstp->rq_sock->sk_xprt.xpt_flags)) 1286 if (test_bit(XPT_DEAD, &rqstp->rq_xprt->xpt_flags))
1277 return -ENOTCONN; 1287 return -ENOTCONN;
1278 1288
1279 sent = svc_sendto(rqstp, &rqstp->rq_res); 1289 sent = svc_sendto(rqstp, &rqstp->rq_res);
1280 if (sent != xbufp->len) { 1290 if (sent != xbufp->len) {
1281 printk(KERN_NOTICE "rpc-srv/tcp: %s: %s %d when sending %d bytes - shutting down socket\n", 1291 printk(KERN_NOTICE "rpc-srv/tcp: %s: %s %d when sending %d bytes - shutting down socket\n",
1282 rqstp->rq_sock->sk_xprt.xpt_server->sv_name, 1292 rqstp->rq_xprt->xpt_server->sv_name,
1283 (sent<0)?"got error":"sent only", 1293 (sent<0)?"got error":"sent only",
1284 sent, xbufp->len); 1294 sent, xbufp->len);
1285 set_bit(XPT_CLOSE, &rqstp->rq_sock->sk_xprt.xpt_flags); 1295 set_bit(XPT_CLOSE, &rqstp->rq_xprt->xpt_flags);
1286 svc_xprt_enqueue(rqstp->rq_xprt); 1296 svc_xprt_enqueue(rqstp->rq_xprt);
1287 sent = -EAGAIN; 1297 sent = -EAGAIN;
1288 } 1298 }
@@ -1302,7 +1312,7 @@ static void svc_tcp_prep_reply_hdr(struct svc_rqst *rqstp)
1302 1312
1303static int svc_tcp_has_wspace(struct svc_xprt *xprt) 1313static int svc_tcp_has_wspace(struct svc_xprt *xprt)
1304{ 1314{
1305 struct svc_sock *svsk = container_of(xprt, struct svc_sock, sk_xprt); 1315 struct svc_sock *svsk = container_of(xprt, struct svc_sock, sk_xprt);
1306 struct svc_serv *serv = svsk->sk_xprt.xpt_server; 1316 struct svc_serv *serv = svsk->sk_xprt.xpt_server;
1307 int required; 1317 int required;
1308 int wspace; 1318 int wspace;
@@ -1625,7 +1635,7 @@ svc_recv(struct svc_rqst *rqstp, long timeout)
1625void 1635void
1626svc_drop(struct svc_rqst *rqstp) 1636svc_drop(struct svc_rqst *rqstp)
1627{ 1637{
1628 dprintk("svc: socket %p dropped request\n", rqstp->rq_sock); 1638 dprintk("svc: xprt %p dropped request\n", rqstp->rq_xprt);
1629 svc_xprt_release(rqstp); 1639 svc_xprt_release(rqstp);
1630} 1640}
1631 1641