Message ID | 1495982239-17054-1-git-send-email-zlpnobody@163.com |
---|---|
State | Accepted |
Delegated to: | Pablo Neira |
Headers | show |
Hi Liping, [auto build test ERROR on nf-next/master] url: https://github.com/0day-ci/linux/commits/Liping-Zhang/netfilter-cttimeout-use-nf_ct_iterate_cleanup_net-to-unlink-timeout-objs/20170528-232231 base: https://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git master config: x86_64-randconfig-x014-201722 (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All errors (new ones prefixed by >>): net/netfilter/nfnetlink_cttimeout.c: In function 'ctnl_untimeout': >> net/netfilter/nfnetlink_cttimeout.c:303:2: error: implicit declaration of function 'nf_ct_iterate_cleanup_net' [-Werror=implicit-function-declaration] nf_ct_iterate_cleanup_net(net, untimeout, timeout, 0, 0); ^~~~~~~~~~~~~~~~~~~~~~~~~ Cyclomatic Complexity 5 include/linux/compiler.h:__read_once_size Cyclomatic Complexity 5 include/linux/compiler.h:__write_once_size Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:fls64 Cyclomatic Complexity 1 include/linux/log2.h:__ilog2_u64 Cyclomatic Complexity 1 include/linux/list.h:INIT_LIST_HEAD Cyclomatic Complexity 1 include/linux/list.h:__list_del Cyclomatic Complexity 1 include/asm-generic/getorder.h:__get_order Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:atomic_read Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:atomic_set Cyclomatic Complexity 1 include/linux/refcount.h:refcount_set Cyclomatic Complexity 1 include/linux/refcount.h:refcount_read Cyclomatic Complexity 1 include/linux/module.h:module_is_live Cyclomatic Complexity 3 include/linux/module.h:try_module_get Cyclomatic Complexity 1 include/linux/module.h:module_put Cyclomatic Complexity 68 include/linux/slab.h:kmalloc_large Cyclomatic Complexity 5 include/linux/slab.h:kmalloc Cyclomatic Complexity 1 include/linux/slab.h:kzalloc Cyclomatic Complexity 1 include/linux/skbuff.h:skb_is_nonlinear Cyclomatic Complexity 1 include/linux/skbuff.h:skb_tail_pointer Cyclomatic Complexity 2 include/linux/skbuff.h:skb_tailroom Cyclomatic Complexity 1 include/net/net_namespace.h:read_pnet Cyclomatic Complexity 1 include/net/netlink.h:nlmsg_msg_size Cyclomatic Complexity 1 include/net/netlink.h:nlmsg_total_size Cyclomatic Complexity 1 include/net/netlink.h:nlmsg_data Cyclomatic Complexity 1 include/net/netlink.h:nlmsg_end Cyclomatic Complexity 1 include/net/netlink.h:nla_data Cyclomatic Complexity 1 include/net/netlink.h:nla_len Cyclomatic Complexity 1 include/net/netlink.h:nla_get_be16 Cyclomatic Complexity 1 include/net/netlink.h:nla_get_u8 Cyclomatic Complexity 1 include/net/netlink.h:nla_nest_end Cyclomatic Complexity 1 include/net/sock.h:sock_net Cyclomatic Complexity 1 include/net/netfilter/nf_conntrack_extend.h:__nf_ct_ext_exist Cyclomatic Complexity 3 include/net/netfilter/nf_conntrack_extend.h:nf_ct_ext_exist Cyclomatic Complexity 2 include/net/netfilter/nf_conntrack_extend.h:__nf_ct_ext_find Cyclomatic Complexity 1 include/net/netfilter/nf_conntrack_timeout.h:nf_ct_timeout_find Cyclomatic Complexity 1 include/linux/netfilter/nfnetlink.h:nfnl_msg_type Cyclomatic Complexity 1 net/netfilter/nfnetlink_cttimeout.c:cttimeout_net_init Cyclomatic Complexity 12 net/netfilter/nfnetlink_cttimeout.c:untimeout Cyclomatic Complexity 4 net/netfilter/nfnetlink_cttimeout.c:ctnl_timeout_put Cyclomatic Complexity 1 include/linux/rcupdate.h:rcu_lock_acquire Cyclomatic Complexity 5 include/linux/rcupdate.h:rcu_read_lock Cyclomatic Complexity 1 include/linux/rcupdate.h:rcu_lock_release Cyclomatic Complexity 5 include/linux/rcupdate.h:rcu_read_unlock Cyclomatic Complexity 6 net/netfilter/nfnetlink_cttimeout.c:ctnl_timeout_find_get Cyclomatic Complexity 1 include/linux/skbuff.h:alloc_skb Cyclomatic Complexity 1 include/net/netlink.h:nlmsg_new Cyclomatic Complexity 2 include/net/netlink.h:nlmsg_put Cyclomatic Complexity 1 include/net/netlink.h:nla_put_be16 Cyclomatic Complexity 1 include/net/netlink.h:nla_put_u8 Cyclomatic Complexity 2 include/net/netlink.h:nla_nest_start Cyclomatic Complexity 1 include/net/netlink.h:nla_put_be32 Cyclomatic Complexity 4 include/net/netlink.h:nlmsg_trim Cyclomatic Complexity 1 include/net/netlink.h:nlmsg_cancel Cyclomatic Complexity 12 net/netfilter/nfnetlink_cttimeout.c:cttimeout_default_fill_info Cyclomatic Complexity 18 net/netfilter/nfnetlink_cttimeout.c:cttimeout_default_get Cyclomatic Complexity 1 include/net/netlink.h:nla_parse_nested Cyclomatic Complexity 4 net/netfilter/nfnetlink_cttimeout.c:ctnl_timeout_parse_policy Cyclomatic Complexity 16 net/netfilter/nfnetlink_cttimeout.c:cttimeout_default_set Cyclomatic Complexity 2 include/linux/list.h:__list_del_entry Cyclomatic Complexity 1 include/linux/rculist.h:list_del_rcu Cyclomatic Complexity 1 net/netfilter/nfnetlink_cttimeout.c:ctnl_untimeout Cyclomatic Complexity 4 net/netfilter/nfnetlink_cttimeout.c:ctnl_timeout_try_del Cyclomatic Complexity 9 net/netfilter/nfnetlink_cttimeout.c:cttimeout_del_timeout Cyclomatic Complexity 3 include/linux/netlink.h:netlink_dump_start Cyclomatic Complexity 1 include/net/netlink.h:nla_put_string Cyclomatic Complexity 14 net/netfilter/nfnetlink_cttimeout.c:ctnl_timeout_fill_info Cyclomatic Complexity 15 net/netfilter/nfnetlink_cttimeout.c:cttimeout_get_timeout Cyclomatic Complexity 13 net/netfilter/nfnetlink_cttimeout.c:ctnl_timeout_dump Cyclomatic Complexity 4 include/linux/rculist.h:__list_add_rcu Cyclomatic Complexity 1 include/linux/rculist.h:list_add_tail_rcu Cyclomatic Complexity 38 net/netfilter/nfnetlink_cttimeout.c:cttimeout_new_timeout Cyclomatic Complexity 5 net/netfilter/nfnetlink_cttimeout.c:cttimeout_net_exit Cyclomatic Complexity 5 net/netfilter/nfnetlink_cttimeout.c:cttimeout_init Cyclomatic Complexity 1 net/netfilter/nfnetlink_cttimeout.c:cttimeout_exit cc1: some warnings being treated as errors vim +/nf_ct_iterate_cleanup_net +303 net/netfilter/nfnetlink_cttimeout.c 297 /* We are not intended to delete this conntrack. */ 298 return 0; 299 } 300 301 static void ctnl_untimeout(struct net *net, struct ctnl_timeout *timeout) 302 { > 303 nf_ct_iterate_cleanup_net(net, untimeout, timeout, 0, 0); 304 } 305 306 /* try to delete object, fail if it is still in use. */ --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Hi, 2017-05-29 0:07 GMT+08:00 kbuild test robot <lkp@intel.com>: > net/netfilter/nfnetlink_cttimeout.c: In function 'ctnl_untimeout': >>> net/netfilter/nfnetlink_cttimeout.c:303:2: error: implicit declaration of function 'nf_ct_iterate_cleanup_net' [-Werror=implicit-function-declaration] > nf_ct_iterate_cleanup_net(net, untimeout, timeout, 0, 0); > ^~~~~~~~~~~~~~~~~~~~~~~~~ This patch is based on Florian's patch set "netfilter: conntrack: rework nf_ct_iterate, part 1.", which has not been applied in nf-next tree. So currently, nf_ct_iterate_destroy and nf_ct_iterate_cleanup_net does not exist in nf-next tree. -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Sun, May 28, 2017 at 10:37:19PM +0800, Liping Zhang wrote: > From: Liping Zhang <zlpnobody@gmail.com> > > Similar to nf_conntrack_helper, we can use nf_ct_iterare_cleanup_net to > remove these copy & paste codes. Also applied, thanks. -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/net/netfilter/nfnetlink_cttimeout.c b/net/netfilter/nfnetlink_cttimeout.c index a3e7bb5..49638b0 100644 --- a/net/netfilter/nfnetlink_cttimeout.c +++ b/net/netfilter/nfnetlink_cttimeout.c @@ -287,49 +287,20 @@ static int cttimeout_get_timeout(struct net *net, struct sock *ctnl, return ret; } -static void untimeout(struct nf_conntrack_tuple_hash *i, - struct ctnl_timeout *timeout) +static int untimeout(struct nf_conn *ct, void *timeout) { - struct nf_conn *ct = nf_ct_tuplehash_to_ctrack(i); struct nf_conn_timeout *timeout_ext = nf_ct_timeout_find(ct); if (timeout_ext && (!timeout || timeout_ext->timeout == timeout)) RCU_INIT_POINTER(timeout_ext->timeout, NULL); + + /* We are not intended to delete this conntrack. */ + return 0; } static void ctnl_untimeout(struct net *net, struct ctnl_timeout *timeout) { - struct nf_conntrack_tuple_hash *h; - const struct hlist_nulls_node *nn; - unsigned int last_hsize; - spinlock_t *lock; - int i, cpu; - - for_each_possible_cpu(cpu) { - struct ct_pcpu *pcpu = per_cpu_ptr(net->ct.pcpu_lists, cpu); - - spin_lock_bh(&pcpu->lock); - hlist_nulls_for_each_entry(h, nn, &pcpu->unconfirmed, hnnode) - untimeout(h, timeout); - spin_unlock_bh(&pcpu->lock); - } - - local_bh_disable(); -restart: - last_hsize = nf_conntrack_htable_size; - for (i = 0; i < last_hsize; i++) { - lock = &nf_conntrack_locks[i % CONNTRACK_LOCKS]; - nf_conntrack_lock(lock); - if (last_hsize != nf_conntrack_htable_size) { - spin_unlock(lock); - goto restart; - } - - hlist_nulls_for_each_entry(h, nn, &nf_conntrack_hash[i], hnnode) - untimeout(h, timeout); - spin_unlock(lock); - } - local_bh_enable(); + nf_ct_iterate_cleanup_net(net, untimeout, timeout, 0, 0); } /* try to delete object, fail if it is still in use. */