@@ -91,12 +91,12 @@ EXPORT_SYMBOL_GPL(raw_v4_hashinfo);
9191int raw_hash_sk (struct sock * sk )
9292{
9393 struct raw_hashinfo * h = sk -> sk_prot -> h .raw_hash ;
94- struct hlist_nulls_head * hlist ;
94+ struct hlist_head * hlist ;
9595
9696 hlist = & h -> ht [raw_hashfunc (sock_net (sk ), inet_sk (sk )-> inet_num )];
9797
9898 spin_lock (& h -> lock );
99- __sk_nulls_add_node_rcu (sk , hlist );
99+ sk_add_node_rcu (sk , hlist );
100100 sock_set_flag (sk , SOCK_RCU_FREE );
101101 spin_unlock (& h -> lock );
102102 sock_prot_inuse_add (sock_net (sk ), sk -> sk_prot , 1 );
@@ -110,7 +110,7 @@ void raw_unhash_sk(struct sock *sk)
110110 struct raw_hashinfo * h = sk -> sk_prot -> h .raw_hash ;
111111
112112 spin_lock (& h -> lock );
113- if (__sk_nulls_del_node_init_rcu (sk ))
113+ if (sk_del_node_init_rcu (sk ))
114114 sock_prot_inuse_add (sock_net (sk ), sk -> sk_prot , -1 );
115115 spin_unlock (& h -> lock );
116116}
@@ -163,16 +163,15 @@ static int icmp_filter(const struct sock *sk, const struct sk_buff *skb)
163163static int raw_v4_input (struct net * net , struct sk_buff * skb ,
164164 const struct iphdr * iph , int hash )
165165{
166- struct hlist_nulls_head * hlist ;
167- struct hlist_nulls_node * hnode ;
168166 int sdif = inet_sdif (skb );
167+ struct hlist_head * hlist ;
169168 int dif = inet_iif (skb );
170169 int delivered = 0 ;
171170 struct sock * sk ;
172171
173172 hlist = & raw_v4_hashinfo .ht [hash ];
174173 rcu_read_lock ();
175- sk_nulls_for_each (sk , hnode , hlist ) {
174+ sk_for_each_rcu (sk , hlist ) {
176175 if (!raw_v4_match (net , sk , iph -> protocol ,
177176 iph -> saddr , iph -> daddr , dif , sdif ))
178177 continue ;
@@ -264,10 +263,9 @@ static void raw_err(struct sock *sk, struct sk_buff *skb, u32 info)
264263void raw_icmp_error (struct sk_buff * skb , int protocol , u32 info )
265264{
266265 struct net * net = dev_net (skb -> dev );
267- struct hlist_nulls_head * hlist ;
268- struct hlist_nulls_node * hnode ;
269266 int dif = skb -> dev -> ifindex ;
270267 int sdif = inet_sdif (skb );
268+ struct hlist_head * hlist ;
271269 const struct iphdr * iph ;
272270 struct sock * sk ;
273271 int hash ;
@@ -276,7 +274,7 @@ void raw_icmp_error(struct sk_buff *skb, int protocol, u32 info)
276274 hlist = & raw_v4_hashinfo .ht [hash ];
277275
278276 rcu_read_lock ();
279- sk_nulls_for_each (sk , hnode , hlist ) {
277+ sk_for_each_rcu (sk , hlist ) {
280278 iph = (const struct iphdr * )skb -> data ;
281279 if (!raw_v4_match (net , sk , iph -> protocol ,
282280 iph -> daddr , iph -> saddr , dif , sdif ))
@@ -950,14 +948,13 @@ static struct sock *raw_get_first(struct seq_file *seq, int bucket)
950948{
951949 struct raw_hashinfo * h = pde_data (file_inode (seq -> file ));
952950 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 ;
955952 struct sock * sk ;
956953
957954 for (state -> bucket = bucket ; state -> bucket < RAW_HTABLE_SIZE ;
958955 ++ state -> bucket ) {
959956 hlist = & h -> ht [state -> bucket ];
960- sk_nulls_for_each (sk , hnode , hlist ) {
957+ sk_for_each (sk , hlist ) {
961958 if (sock_net (sk ) == seq_file_net (seq ))
962959 return sk ;
963960 }
@@ -970,7 +967,7 @@ static struct sock *raw_get_next(struct seq_file *seq, struct sock *sk)
970967 struct raw_iter_state * state = raw_seq_private (seq );
971968
972969 do {
973- sk = sk_nulls_next (sk );
970+ sk = sk_next (sk );
974971 } while (sk && sock_net (sk ) != seq_file_net (seq ));
975972
976973 if (!sk )
@@ -989,9 +986,12 @@ static struct sock *raw_get_idx(struct seq_file *seq, loff_t pos)
989986}
990987
991988void * raw_seq_start (struct seq_file * seq , loff_t * pos )
992- __acquires (RCU )
989+ __acquires (& h - > lock )
993990{
994- rcu_read_lock ();
991+ struct raw_hashinfo * h = pde_data (file_inode (seq -> file ));
992+
993+ spin_lock (& h -> lock );
994+
995995 return * pos ? raw_get_idx (seq , * pos - 1 ) : SEQ_START_TOKEN ;
996996}
997997EXPORT_SYMBOL_GPL (raw_seq_start );
@@ -1010,9 +1010,11 @@ void *raw_seq_next(struct seq_file *seq, void *v, loff_t *pos)
10101010EXPORT_SYMBOL_GPL (raw_seq_next );
10111011
10121012void raw_seq_stop (struct seq_file * seq , void * v )
1013- __releases (RCU )
1013+ __releases (& h - > lock )
10141014{
1015- rcu_read_unlock ();
1015+ struct raw_hashinfo * h = pde_data (file_inode (seq -> file ));
1016+
1017+ spin_unlock (& h -> lock );
10161018}
10171019EXPORT_SYMBOL_GPL (raw_seq_stop );
10181020
0 commit comments