@@ -91,12 +91,12 @@ EXPORT_SYMBOL_GPL(raw_v4_hashinfo);
91
91
int raw_hash_sk (struct sock * sk )
92
92
{
93
93
struct raw_hashinfo * h = sk -> sk_prot -> h .raw_hash ;
94
- struct hlist_nulls_head * hlist ;
94
+ struct hlist_head * hlist ;
95
95
96
96
hlist = & h -> ht [raw_hashfunc (sock_net (sk ), inet_sk (sk )-> inet_num )];
97
97
98
98
spin_lock (& h -> lock );
99
- __sk_nulls_add_node_rcu (sk , hlist );
99
+ sk_add_node_rcu (sk , hlist );
100
100
sock_set_flag (sk , SOCK_RCU_FREE );
101
101
spin_unlock (& h -> lock );
102
102
sock_prot_inuse_add (sock_net (sk ), sk -> sk_prot , 1 );
@@ -110,7 +110,7 @@ void raw_unhash_sk(struct sock *sk)
110
110
struct raw_hashinfo * h = sk -> sk_prot -> h .raw_hash ;
111
111
112
112
spin_lock (& h -> lock );
113
- if (__sk_nulls_del_node_init_rcu (sk ))
113
+ if (sk_del_node_init_rcu (sk ))
114
114
sock_prot_inuse_add (sock_net (sk ), sk -> sk_prot , -1 );
115
115
spin_unlock (& h -> lock );
116
116
}
@@ -163,16 +163,15 @@ static int icmp_filter(const struct sock *sk, const struct sk_buff *skb)
163
163
static int raw_v4_input (struct net * net , struct sk_buff * skb ,
164
164
const struct iphdr * iph , int hash )
165
165
{
166
- struct hlist_nulls_head * hlist ;
167
- struct hlist_nulls_node * hnode ;
168
166
int sdif = inet_sdif (skb );
167
+ struct hlist_head * hlist ;
169
168
int dif = inet_iif (skb );
170
169
int delivered = 0 ;
171
170
struct sock * sk ;
172
171
173
172
hlist = & raw_v4_hashinfo .ht [hash ];
174
173
rcu_read_lock ();
175
- sk_nulls_for_each (sk , hnode , hlist ) {
174
+ sk_for_each_rcu (sk , hlist ) {
176
175
if (!raw_v4_match (net , sk , iph -> protocol ,
177
176
iph -> saddr , iph -> daddr , dif , sdif ))
178
177
continue ;
@@ -264,10 +263,9 @@ static void raw_err(struct sock *sk, struct sk_buff *skb, u32 info)
264
263
void raw_icmp_error (struct sk_buff * skb , int protocol , u32 info )
265
264
{
266
265
struct net * net = dev_net (skb -> dev );
267
- struct hlist_nulls_head * hlist ;
268
- struct hlist_nulls_node * hnode ;
269
266
int dif = skb -> dev -> ifindex ;
270
267
int sdif = inet_sdif (skb );
268
+ struct hlist_head * hlist ;
271
269
const struct iphdr * iph ;
272
270
struct sock * sk ;
273
271
int hash ;
@@ -276,7 +274,7 @@ void raw_icmp_error(struct sk_buff *skb, int protocol, u32 info)
276
274
hlist = & raw_v4_hashinfo .ht [hash ];
277
275
278
276
rcu_read_lock ();
279
- sk_nulls_for_each (sk , hnode , hlist ) {
277
+ sk_for_each_rcu (sk , hlist ) {
280
278
iph = (const struct iphdr * )skb -> data ;
281
279
if (!raw_v4_match (net , sk , iph -> protocol ,
282
280
iph -> daddr , iph -> saddr , dif , sdif ))
@@ -950,14 +948,13 @@ static struct sock *raw_get_first(struct seq_file *seq, int bucket)
950
948
{
951
949
struct raw_hashinfo * h = pde_data (file_inode (seq -> file ));
952
950
struct raw_iter_state * state = raw_seq_private (seq );
953
- struct hlist_nulls_head * hlist ;
954
- struct hlist_nulls_node * hnode ;
951
+ struct hlist_head * hlist ;
955
952
struct sock * sk ;
956
953
957
954
for (state -> bucket = bucket ; state -> bucket < RAW_HTABLE_SIZE ;
958
955
++ state -> bucket ) {
959
956
hlist = & h -> ht [state -> bucket ];
960
- sk_nulls_for_each (sk , hnode , hlist ) {
957
+ sk_for_each (sk , hlist ) {
961
958
if (sock_net (sk ) == seq_file_net (seq ))
962
959
return sk ;
963
960
}
@@ -970,7 +967,7 @@ static struct sock *raw_get_next(struct seq_file *seq, struct sock *sk)
970
967
struct raw_iter_state * state = raw_seq_private (seq );
971
968
972
969
do {
973
- sk = sk_nulls_next (sk );
970
+ sk = sk_next (sk );
974
971
} while (sk && sock_net (sk ) != seq_file_net (seq ));
975
972
976
973
if (!sk )
@@ -989,9 +986,12 @@ static struct sock *raw_get_idx(struct seq_file *seq, loff_t pos)
989
986
}
990
987
991
988
void * raw_seq_start (struct seq_file * seq , loff_t * pos )
992
- __acquires (RCU )
989
+ __acquires (& h - > lock )
993
990
{
994
- rcu_read_lock ();
991
+ struct raw_hashinfo * h = pde_data (file_inode (seq -> file ));
992
+
993
+ spin_lock (& h -> lock );
994
+
995
995
return * pos ? raw_get_idx (seq , * pos - 1 ) : SEQ_START_TOKEN ;
996
996
}
997
997
EXPORT_SYMBOL_GPL (raw_seq_start );
@@ -1010,9 +1010,11 @@ void *raw_seq_next(struct seq_file *seq, void *v, loff_t *pos)
1010
1010
EXPORT_SYMBOL_GPL (raw_seq_next );
1011
1011
1012
1012
void raw_seq_stop (struct seq_file * seq , void * v )
1013
- __releases (RCU )
1013
+ __releases (& h - > lock )
1014
1014
{
1015
- rcu_read_unlock ();
1015
+ struct raw_hashinfo * h = pde_data (file_inode (seq -> file ));
1016
+
1017
+ spin_unlock (& h -> lock );
1016
1018
}
1017
1019
EXPORT_SYMBOL_GPL (raw_seq_stop );
1018
1020
0 commit comments