]> git.ipfire.org Git - thirdparty/ipset.git/commitdiff
Fix compatibility support for netlink extended ACK and add synchronize_rcu_bh() checking
authorJozsef Kadlecsik <kadlec@netfilter.org>
Fri, 1 Nov 2019 14:40:33 +0000 (15:40 +0100)
committerJozsef Kadlecsik <kadlec@netfilter.org>
Fri, 1 Nov 2019 14:40:33 +0000 (15:40 +0100)
configure.ac
kernel/include/linux/netfilter/ipset/ip_set_compat.h.in
kernel/net/netfilter/ipset/ip_set_hash_gen.h

index 75f43c72ef9ce6732eeca57561e89db5cc1724b2..5a0f18ad8a1a04cab7375c61816669e669d9fa20 100644 (file)
@@ -581,7 +581,7 @@ fi
 
 AC_MSG_CHECKING([kernel source for netlink extended ACK])
 if test -f $ksourcedir/include/linux/netlink.h && \
-   $AWK '/^extern void netlink_ack\(/,/\)/' $ksourcedir/include/linux/netlink.h | $GREP -q 'const struct netlink_ext_ack'; then
+   $AWK '/void netlink_ack\(/,/\)/' $ksourcedir/include/linux/netlink.h | $GREP -q 'const struct netlink_ext_ack'; then
        AC_MSG_RESULT(yes)
        AC_SUBST(HAVE_NETLINK_EXTENDED_ACK, define)
 else
@@ -649,6 +649,17 @@ else
        AC_SUBST(HAVE_STRSCPY, undef)
 fi
 
+AC_MSG_CHECKING([kernel source for synchronize_rcu_bh() in rcutiny.h and rcupdate.h])
+if test -f $ksourcedir/include/linux/rcupdate.h && \
+   $GREP -q 'static inline void synchronize_rcu_bh' \
+       $ksourcedir/include/linux/rcutiny.h $ksourcedir/include/linux/rcupdate.h; then
+       AC_MSG_RESULT(yes)
+       AC_SUBST(HAVE_SYNCHRONIZE_RCU_BH, define)
+else
+       AC_MSG_RESULT(no)
+       AC_SUBST(HAVE_SYNCHRONIZE_RCU_BH, undef)
+fi
+
 AC_MSG_CHECKING([kernel source for struct net_generic])
 if test -f $ksourcedir/include/net/netns/generic.h && \
    $GREP -q 'struct net_generic' $ksourcedir/include/net/netns/generic.h; then
index 415104d45b80a54b3adf665109e191963f4bd83b..5f12ad82b0acaaffddfabc487ab260f8d6a2c465 100644 (file)
@@ -48,6 +48,7 @@
 #@HAVE_TYPEDEF_SCTP_SCTPHDR_T@ HAVE_TYPEDEF_SCTP_SCTPHDR_T
 #@HAVE_TIMER_SETUP@ HAVE_TIMER_SETUP
 #@HAVE_STRSCPY@ HAVE_STRSCPY
+#@HAVE_SYNCHRONIZE_RCU_BH@ HAVE_SYNCHRONIZE_RCU_BH
 #@HAVE_LOCKDEP_NFNL_IS_HELD@ HAVE_LOCKDEP_NFNL_IS_HELD
 
 #ifdef HAVE_EXPORT_SYMBOL_GPL_IN_MODULE_H
 #include <linux/version.h>
 #include <linux/netlink.h>
 
+#ifdef HAVE_SYNCHRONIZE_RCU_BH
+#define synchronize_rcu()              synchronize_rcu_bh()
+#endif
+
 #ifndef rcu_dereference_bh
 #define rcu_dereference_bh(p)          rcu_dereference(p)
 #endif
index cc0e754bfecd933bee227f887c5669284a477207..1767fed494a5703a019cf9c86b653e0c96e556b0 100644 (file)
@@ -663,7 +663,7 @@ retry:
        spin_unlock_bh(&set->lock);
 
        /* Give time to other readers of the set */
-       synchronize_rcu_bh();
+       synchronize_rcu();
 
        pr_debug("set %s resized from %u (%p) to %u (%p)\n", set->name,
                 orig->htable_bits, orig, t->htable_bits, t);