@@ -488,9 +488,9 @@ static int ipmr_mfc_seq_show(struct seq_file *seq, void *v)
488488
489489 if (it -> cache != & mrt -> mfc_unres_queue ) {
490490 seq_printf (seq , " %8lu %8lu %8lu" ,
491- mfc -> _c .mfc_un .res .pkt ,
492- mfc -> _c .mfc_un .res .bytes ,
493- mfc -> _c .mfc_un .res .wrong_if );
491+ atomic_long_read ( & mfc -> _c .mfc_un .res .pkt ) ,
492+ atomic_long_read ( & mfc -> _c .mfc_un .res .bytes ) ,
493+ atomic_long_read ( & mfc -> _c .mfc_un .res .wrong_if ) );
494494 for (n = mfc -> _c .mfc_un .res .minvif ;
495495 n < mfc -> _c .mfc_un .res .maxvif ; n ++ ) {
496496 if (VIF_EXISTS (mrt , n ) &&
@@ -855,7 +855,7 @@ static void ip6mr_update_thresholds(struct mr_table *mrt,
855855 cache -> mfc_un .res .maxvif = vifi + 1 ;
856856 }
857857 }
858- cache -> mfc_un .res .lastuse = jiffies ;
858+ WRITE_ONCE ( cache -> mfc_un .res .lastuse , jiffies ) ;
859859}
860860
861861static int mif6_add (struct net * net , struct mr_table * mrt ,
@@ -1903,9 +1903,9 @@ int ip6mr_ioctl(struct sock *sk, int cmd, void *arg)
19031903 c = ip6mr_cache_find (mrt , & sr -> src .sin6_addr ,
19041904 & sr -> grp .sin6_addr );
19051905 if (c ) {
1906- sr -> pktcnt = c -> _c .mfc_un .res .pkt ;
1907- sr -> bytecnt = c -> _c .mfc_un .res .bytes ;
1908- sr -> wrong_if = c -> _c .mfc_un .res .wrong_if ;
1906+ sr -> pktcnt = atomic_long_read ( & c -> _c .mfc_un .res .pkt ) ;
1907+ sr -> bytecnt = atomic_long_read ( & c -> _c .mfc_un .res .bytes ) ;
1908+ sr -> wrong_if = atomic_long_read ( & c -> _c .mfc_un .res .wrong_if ) ;
19091909 rcu_read_unlock ();
19101910 return 0 ;
19111911 }
@@ -1975,9 +1975,9 @@ int ip6mr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg)
19751975 rcu_read_lock ();
19761976 c = ip6mr_cache_find (mrt , & sr .src .sin6_addr , & sr .grp .sin6_addr );
19771977 if (c ) {
1978- sr .pktcnt = c -> _c .mfc_un .res .pkt ;
1979- sr .bytecnt = c -> _c .mfc_un .res .bytes ;
1980- sr .wrong_if = c -> _c .mfc_un .res .wrong_if ;
1978+ sr .pktcnt = atomic_long_read ( & c -> _c .mfc_un .res .pkt ) ;
1979+ sr .bytecnt = atomic_long_read ( & c -> _c .mfc_un .res .bytes ) ;
1980+ sr .wrong_if = atomic_long_read ( & c -> _c .mfc_un .res .wrong_if ) ;
19811981 rcu_read_unlock ();
19821982
19831983 if (copy_to_user (arg , & sr , sizeof (sr )))
@@ -2097,9 +2097,9 @@ static void ip6_mr_forward(struct net *net, struct mr_table *mrt,
20972097 int true_vifi = ip6mr_find_vif (mrt , dev );
20982098
20992099 vif = c -> _c .mfc_parent ;
2100- c -> _c .mfc_un .res .pkt ++ ;
2101- c -> _c .mfc_un .res .bytes += skb -> len ;
2102- c -> _c .mfc_un .res .lastuse = jiffies ;
2100+ atomic_long_inc ( & c -> _c .mfc_un .res .pkt ) ;
2101+ atomic_long_add ( skb -> len , & c -> _c .mfc_un .res .bytes ) ;
2102+ WRITE_ONCE ( c -> _c .mfc_un .res .lastuse , jiffies ) ;
21032103
21042104 if (ipv6_addr_any (& c -> mf6c_origin ) && true_vifi >= 0 ) {
21052105 struct mfc6_cache * cache_proxy ;
@@ -2121,7 +2121,7 @@ static void ip6_mr_forward(struct net *net, struct mr_table *mrt,
21212121 * Wrong interface: drop packet and (maybe) send PIM assert.
21222122 */
21232123 if (mrt -> vif_table [vif ].dev != dev ) {
2124- c -> _c .mfc_un .res .wrong_if ++ ;
2124+ atomic_long_inc ( & c -> _c .mfc_un .res .wrong_if ) ;
21252125
21262126 if (true_vifi >= 0 && mrt -> mroute_do_assert &&
21272127 /* pimsm uses asserts, when switching from RPT to SPT,
0 commit comments