af_unix: Put a socket into a per-netns hash table.
[linux-2.6-microblaze.git] / net / unix / diag.c
index 7fc3774..4d0f0ca 100644 (file)
@@ -210,9 +210,7 @@ static int unix_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
                num = 0;
                spin_lock(&unix_table_locks[slot]);
                spin_lock(&net->unx.table.locks[slot]);
-               sk_for_each(sk, &unix_socket_table[slot]) {
-                       if (!net_eq(sock_net(sk), net))
-                               continue;
+               sk_for_each(sk, &net->unx.table.buckets[slot]) {
                        if (num < s_num)
                                goto next;
                        if (!(req->udiag_states & (1 << sk->sk_state)))
@@ -246,13 +244,14 @@ static struct sock *unix_lookup_by_ino(struct net *net, unsigned int ino)
        for (i = 0; i < UNIX_HASH_SIZE; i++) {
                spin_lock(&unix_table_locks[i]);
                spin_lock(&net->unx.table.locks[i]);
-               sk_for_each(sk, &unix_socket_table[i])
+               sk_for_each(sk, &net->unx.table.buckets[i]) {
                        if (ino == sock_i_ino(sk)) {
                                sock_hold(sk);
                                spin_unlock(&net->unx.table.locks[i]);
                                spin_unlock(&unix_table_locks[i]);
                                return sk;
                        }
+               }
                spin_unlock(&net->unx.table.locks[i]);
                spin_unlock(&unix_table_locks[i]);
        }
@@ -277,8 +276,6 @@ static int unix_diag_get_exact(struct sk_buff *in_skb,
        err = -ENOENT;
        if (sk == NULL)
                goto out_nosk;
-       if (!net_eq(sock_net(sk), net))
-               goto out;
 
        err = sock_diag_check_cookie(sk, req->udiag_cookie);
        if (err)