mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-25 20:10:23 +09:00
Revert "net: inet: Remove count from inet_listen_hashbucket"
This reverts commitbb9bcf47fbwhich is commit8ea1eebb49upstream. It breaks the Android kernel abi and can be brought back in the future in an abi-safe way if it is really needed. Bug: 161946584 Change-Id: I7312d7514465b14b40fbc96f35d15a3af057168e Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
@@ -111,6 +111,7 @@ struct inet_bind_hashbucket {
|
||||
#define LISTENING_NULLS_BASE (1U << 29)
|
||||
struct inet_listen_hashbucket {
|
||||
spinlock_t lock;
|
||||
unsigned int count;
|
||||
union {
|
||||
struct hlist_head head;
|
||||
struct hlist_nulls_head nulls_head;
|
||||
|
||||
@@ -209,6 +209,7 @@ static void inet_hash2(struct inet_hashinfo *h, struct sock *sk)
|
||||
else
|
||||
hlist_add_head_rcu(&inet_csk(sk)->icsk_listen_portaddr_node,
|
||||
&ilb2->head);
|
||||
ilb2->count++;
|
||||
spin_unlock(&ilb2->lock);
|
||||
}
|
||||
|
||||
@@ -224,6 +225,7 @@ static void inet_unhash2(struct inet_hashinfo *h, struct sock *sk)
|
||||
|
||||
spin_lock(&ilb2->lock);
|
||||
hlist_del_init_rcu(&inet_csk(sk)->icsk_listen_portaddr_node);
|
||||
ilb2->count--;
|
||||
spin_unlock(&ilb2->lock);
|
||||
}
|
||||
|
||||
@@ -650,6 +652,7 @@ int __inet_hash(struct sock *sk, struct sock *osk)
|
||||
else
|
||||
__sk_nulls_add_node_rcu(sk, &ilb->nulls_head);
|
||||
inet_hash2(hashinfo, sk);
|
||||
ilb->count++;
|
||||
sock_set_flag(sk, SOCK_RCU_FREE);
|
||||
sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
|
||||
unlock:
|
||||
@@ -681,6 +684,7 @@ static void __inet_unhash(struct sock *sk, struct inet_listen_hashbucket *ilb)
|
||||
struct inet_hashinfo *hashinfo = sk->sk_prot->h.hashinfo;
|
||||
|
||||
inet_unhash2(hashinfo, sk);
|
||||
ilb->count--;
|
||||
}
|
||||
__sk_nulls_del_node_init_rcu(sk);
|
||||
sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1);
|
||||
@@ -863,6 +867,7 @@ void inet_hashinfo_init(struct inet_hashinfo *h)
|
||||
spin_lock_init(&h->listening_hash[i].lock);
|
||||
INIT_HLIST_NULLS_HEAD(&h->listening_hash[i].nulls_head,
|
||||
i + LISTENING_NULLS_BASE);
|
||||
h->listening_hash[i].count = 0;
|
||||
}
|
||||
|
||||
h->lhash2 = NULL;
|
||||
@@ -876,6 +881,7 @@ static void init_hashinfo_lhash2(struct inet_hashinfo *h)
|
||||
for (i = 0; i <= h->lhash2_mask; i++) {
|
||||
spin_lock_init(&h->lhash2[i].lock);
|
||||
INIT_HLIST_HEAD(&h->lhash2[i].head);
|
||||
h->lhash2[i].count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user