Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
[safe/jmp/linux-2.6] / net / sunrpc / svcsock.c
index 1c246a4..7e534dd 100644 (file)
@@ -150,7 +150,6 @@ static void svc_set_cmsg_data(struct svc_rqst *rqstp, struct cmsghdr *cmh)
                }
                break;
        }
-       return;
 }
 
 /*
@@ -272,14 +271,14 @@ static int svc_one_sock_name(struct svc_sock *svsk, char *buf, int remaining)
        case PF_INET:
                len = snprintf(buf, remaining, "ipv4 %s %pI4 %d\n",
                                proto_name,
-                               &inet_sk(sk)->rcv_saddr,
-                               inet_sk(sk)->num);
+                               &inet_sk(sk)->inet_rcv_saddr,
+                               inet_sk(sk)->inet_num);
                break;
        case PF_INET6:
                len = snprintf(buf, remaining, "ipv6 %s %pI6 %d\n",
                                proto_name,
                                &inet6_sk(sk)->rcv_saddr,
-                               inet_sk(sk)->num);
+                               inet_sk(sk)->inet_num);
                break;
        default:
                len = snprintf(buf, remaining, "*unknown-%d*\n",
@@ -419,8 +418,8 @@ static void svc_udp_data_ready(struct sock *sk, int count)
                set_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags);
                svc_xprt_enqueue(&svsk->sk_xprt);
        }
-       if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
-               wake_up_interruptible(sk->sk_sleep);
+       if (sk_sleep(sk) && waitqueue_active(sk_sleep(sk)))
+               wake_up_interruptible(sk_sleep(sk));
 }
 
 /*
@@ -436,10 +435,10 @@ static void svc_write_space(struct sock *sk)
                svc_xprt_enqueue(&svsk->sk_xprt);
        }
 
-       if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) {
+       if (sk_sleep(sk) && waitqueue_active(sk_sleep(sk))) {
                dprintk("RPC svc_write_space: someone sleeping on %p\n",
                       svsk);
-               wake_up_interruptible(sk->sk_sleep);
+               wake_up_interruptible(sk_sleep(sk));
        }
 }
 
@@ -547,7 +546,6 @@ static int svc_udp_recvfrom(struct svc_rqst *rqstp)
                        dprintk("svc: recvfrom returned error %d\n", -err);
                        set_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags);
                }
-               svc_xprt_received(&svsk->sk_xprt);
                return -EAGAIN;
        }
        len = svc_addr_len(svc_addr(rqstp));
@@ -562,11 +560,6 @@ static int svc_udp_recvfrom(struct svc_rqst *rqstp)
        svsk->sk_sk->sk_stamp = skb->tstamp;
        set_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags); /* there may be more data... */
 
-       /*
-        * Maybe more packets - kick another thread ASAP.
-        */
-       svc_xprt_received(&svsk->sk_xprt);
-
        len  = skb->len - sizeof(struct udphdr);
        rqstp->rq_arg.len = len;
 
@@ -757,8 +750,8 @@ static void svc_tcp_listen_data_ready(struct sock *sk, int count_unused)
                        printk("svc: socket %p: no user data\n", sk);
        }
 
-       if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
-               wake_up_interruptible_all(sk->sk_sleep);
+       if (sk_sleep(sk) && waitqueue_active(sk_sleep(sk)))
+               wake_up_interruptible_all(sk_sleep(sk));
 }
 
 /*
@@ -777,8 +770,8 @@ static void svc_tcp_state_change(struct sock *sk)
                set_bit(XPT_CLOSE, &svsk->sk_xprt.xpt_flags);
                svc_xprt_enqueue(&svsk->sk_xprt);
        }
-       if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
-               wake_up_interruptible_all(sk->sk_sleep);
+       if (sk_sleep(sk) && waitqueue_active(sk_sleep(sk)))
+               wake_up_interruptible_all(sk_sleep(sk));
 }
 
 static void svc_tcp_data_ready(struct sock *sk, int count)
@@ -791,8 +784,8 @@ static void svc_tcp_data_ready(struct sock *sk, int count)
                set_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags);
                svc_xprt_enqueue(&svsk->sk_xprt);
        }
-       if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
-               wake_up_interruptible(sk->sk_sleep);
+       if (sk_sleep(sk) && waitqueue_active(sk_sleep(sk)))
+               wake_up_interruptible(sk_sleep(sk));
 }
 
 /*
@@ -917,7 +910,6 @@ static int svc_tcp_recv_record(struct svc_sock *svsk, struct svc_rqst *rqstp)
                if (len < want) {
                        dprintk("svc: short recvfrom while reading record "
                                "length (%d of %d)\n", len, want);
-                       svc_xprt_received(&svsk->sk_xprt);
                        goto err_again; /* record header not complete */
                }
 
@@ -953,7 +945,6 @@ static int svc_tcp_recv_record(struct svc_sock *svsk, struct svc_rqst *rqstp)
        if (len < svsk->sk_reclen) {
                dprintk("svc: incomplete TCP record (%d of %d)\n",
                        len, svsk->sk_reclen);
-               svc_xprt_received(&svsk->sk_xprt);
                goto err_again; /* record not complete */
        }
        len = svsk->sk_reclen;
@@ -961,10 +952,8 @@ static int svc_tcp_recv_record(struct svc_sock *svsk, struct svc_rqst *rqstp)
 
        return len;
  error:
-       if (len == -EAGAIN) {
+       if (len == -EAGAIN)
                dprintk("RPC: TCP recv_record got EAGAIN\n");
-               svc_xprt_received(&svsk->sk_xprt);
-       }
        return len;
  err_delete:
        set_bit(XPT_CLOSE, &svsk->sk_xprt.xpt_flags);
@@ -1109,7 +1098,6 @@ out:
        svsk->sk_tcplen = 0;
 
        svc_xprt_copy_addrs(rqstp, &svsk->sk_xprt);
-       svc_xprt_received(&svsk->sk_xprt);
        if (serv->sv_stats)
                serv->sv_stats->nettcpcnt++;
 
@@ -1118,7 +1106,6 @@ out:
 err_again:
        if (len == -EAGAIN) {
                dprintk("RPC: TCP recvfrom got EAGAIN\n");
-               svc_xprt_received(&svsk->sk_xprt);
                return len;
        }
 error:
@@ -1311,7 +1298,7 @@ static struct svc_sock *svc_setup_socket(struct svc_serv *serv,
        /* Register socket with portmapper */
        if (*errp >= 0 && pmap_register)
                *errp = svc_register(serv, inet->sk_family, inet->sk_protocol,
-                                    ntohs(inet_sk(inet)->sport));
+                                    ntohs(inet_sk(inet)->inet_sport));
 
        if (*errp < 0) {
                kfree(svsk);
@@ -1357,7 +1344,7 @@ int svc_addsock(struct svc_serv *serv, const int fd, char *name_return,
 
        if (!so)
                return err;
-       if (so->sk->sk_family != AF_INET)
+       if ((so->sk->sk_family != PF_INET) && (so->sk->sk_family != PF_INET6))
                err =  -EAFNOSUPPORT;
        else if (so->sk->sk_protocol != IPPROTO_TCP &&
            so->sk->sk_protocol != IPPROTO_UDP)
@@ -1493,8 +1480,8 @@ static void svc_sock_detach(struct svc_xprt *xprt)
        sk->sk_data_ready = svsk->sk_odata;
        sk->sk_write_space = svsk->sk_owspace;
 
-       if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
-               wake_up_interruptible(sk->sk_sleep);
+       if (sk_sleep(sk) && waitqueue_active(sk_sleep(sk)))
+               wake_up_interruptible(sk_sleep(sk));
 }
 
 /*