@@ -831,7 +831,7 @@ static void ipmr_update_thresholds(struct mr_table *mrt, struct mr_mfc *cache,
831831 cache -> mfc_un .res .maxvif = vifi + 1 ;
832832 }
833833 }
834- cache -> mfc_un .res .lastuse = jiffies ;
834+ WRITE_ONCE ( cache -> mfc_un .res .lastuse , jiffies ) ;
835835}
836836
837837static int vif_add (struct net * net , struct mr_table * mrt ,
@@ -1681,9 +1681,9 @@ int ipmr_ioctl(struct sock *sk, int cmd, void *arg)
16811681 rcu_read_lock ();
16821682 c = ipmr_cache_find (mrt , sr -> src .s_addr , sr -> grp .s_addr );
16831683 if (c ) {
1684- sr -> pktcnt = c -> _c .mfc_un .res .pkt ;
1685- sr -> bytecnt = c -> _c .mfc_un .res .bytes ;
1686- sr -> wrong_if = c -> _c .mfc_un .res .wrong_if ;
1684+ sr -> pktcnt = atomic_long_read ( & c -> _c .mfc_un .res .pkt ) ;
1685+ sr -> bytecnt = atomic_long_read ( & c -> _c .mfc_un .res .bytes ) ;
1686+ sr -> wrong_if = atomic_long_read ( & c -> _c .mfc_un .res .wrong_if ) ;
16871687 rcu_read_unlock ();
16881688 return 0 ;
16891689 }
@@ -1753,9 +1753,9 @@ int ipmr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg)
17531753 rcu_read_lock ();
17541754 c = ipmr_cache_find (mrt , sr .src .s_addr , sr .grp .s_addr );
17551755 if (c ) {
1756- sr .pktcnt = c -> _c .mfc_un .res .pkt ;
1757- sr .bytecnt = c -> _c .mfc_un .res .bytes ;
1758- sr .wrong_if = c -> _c .mfc_un .res .wrong_if ;
1756+ sr .pktcnt = atomic_long_read ( & c -> _c .mfc_un .res .pkt ) ;
1757+ sr .bytecnt = atomic_long_read ( & c -> _c .mfc_un .res .bytes ) ;
1758+ sr .wrong_if = atomic_long_read ( & c -> _c .mfc_un .res .wrong_if ) ;
17591759 rcu_read_unlock ();
17601760
17611761 if (copy_to_user (arg , & sr , sizeof (sr )))
@@ -1988,9 +1988,9 @@ static void ip_mr_forward(struct net *net, struct mr_table *mrt,
19881988 int vif , ct ;
19891989
19901990 vif = c -> _c .mfc_parent ;
1991- c -> _c .mfc_un .res .pkt ++ ;
1992- c -> _c .mfc_un .res .bytes += skb -> len ;
1993- c -> _c .mfc_un .res .lastuse = jiffies ;
1991+ atomic_long_inc ( & c -> _c .mfc_un .res .pkt ) ;
1992+ atomic_long_add ( skb -> len , & c -> _c .mfc_un .res .bytes ) ;
1993+ WRITE_ONCE ( c -> _c .mfc_un .res .lastuse , jiffies ) ;
19941994
19951995 if (c -> mfc_origin == htonl (INADDR_ANY ) && true_vifi >= 0 ) {
19961996 struct mfc_cache * cache_proxy ;
@@ -2021,7 +2021,7 @@ static void ip_mr_forward(struct net *net, struct mr_table *mrt,
20212021 goto dont_forward ;
20222022 }
20232023
2024- c -> _c .mfc_un .res .wrong_if ++ ;
2024+ atomic_long_inc ( & c -> _c .mfc_un .res .wrong_if ) ;
20252025
20262026 if (true_vifi >= 0 && mrt -> mroute_do_assert &&
20272027 /* pimsm uses asserts, when switching from RPT to SPT,
@@ -3029,9 +3029,9 @@ static int ipmr_mfc_seq_show(struct seq_file *seq, void *v)
30293029
30303030 if (it -> cache != & mrt -> mfc_unres_queue ) {
30313031 seq_printf (seq , " %8lu %8lu %8lu" ,
3032- mfc -> _c .mfc_un .res .pkt ,
3033- mfc -> _c .mfc_un .res .bytes ,
3034- mfc -> _c .mfc_un .res .wrong_if );
3032+ atomic_long_read ( & mfc -> _c .mfc_un .res .pkt ) ,
3033+ atomic_long_read ( & mfc -> _c .mfc_un .res .bytes ) ,
3034+ atomic_long_read ( & mfc -> _c .mfc_un .res .wrong_if ) );
30353035 for (n = mfc -> _c .mfc_un .res .minvif ;
30363036 n < mfc -> _c .mfc_un .res .maxvif ; n ++ ) {
30373037 if (VIF_EXISTS (mrt , n ) &&
0 commit comments