Commit 1eba8002 authored by Steven Rostedt's avatar Steven Rostedt Committed by Thomas Gleixner

net: use a rcu callback for nf_conntrack_destroy

__nf_conntrack_destroy is called with preemption disabled and calls
functions that will schedule in PREEMPT_RT. When PREEMPT_RT is defined
we call an RCU callback to do the destruction at a later time.
Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 7e6a731d
......@@ -98,6 +98,9 @@ struct pipe_inode_info;
#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
struct nf_conntrack {
atomic_t use;
#ifdef CONFIG_PREEMPT_RT
struct rcu_head rcu;
#endif
};
#endif
......
......@@ -233,7 +233,7 @@ EXPORT_SYMBOL(nf_ct_attach);
void (*nf_ct_destroy)(struct nf_conntrack *);
EXPORT_SYMBOL(nf_ct_destroy);
void nf_conntrack_destroy(struct nf_conntrack *nfct)
static void __nf_conntrack_destroy(struct nf_conntrack *nfct)
{
void (*destroy)(struct nf_conntrack *);
......@@ -243,6 +243,28 @@ void nf_conntrack_destroy(struct nf_conntrack *nfct)
destroy(nfct);
rcu_read_unlock();
}
#ifdef CONFIG_PREEMPT_RT
/*
* nf_contrack_destroy is called with preemption disabled
* and will call functions that might schedule in PREEMPT_RT.
* For PREEMPT_RT we use a rcu callback instead to handle
* the destroying.
*/
static void nf_conntrack_destroy_rcu(struct rcu_head *rhp)
{
__nf_conntrack_destroy(container_of(rhp, struct nf_conntrack, rcu));
}
void nf_conntrack_destroy(struct nf_conntrack *nfct)
{
call_rcu(&nfct->rcu, nf_conntrack_destroy_rcu);
}
#else /* !PREEMPT_RT */
void nf_conntrack_destroy(struct nf_conntrack *nfct)
{
__nf_conntrack_destroy(nfct);
}
#endif /* PREEMPT_RT */
EXPORT_SYMBOL(nf_conntrack_destroy);
#endif /* CONFIG_NF_CONNTRACK */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment