Commit 0a182454 authored by James Morris's avatar James Morris Committed by David S. Miller

[IPSEC]: Really move type destructor out of spinlock.

parent 88f3b6af
...@@ -60,9 +60,12 @@ static void xfrm_state_gc_destroy(struct xfrm_state *x) ...@@ -60,9 +60,12 @@ static void xfrm_state_gc_destroy(struct xfrm_state *x)
kfree(x->calg); kfree(x->calg);
if (x->encap) if (x->encap)
kfree(x->encap); kfree(x->encap);
if (x->type) if (x->type) {
x->type->destructor(x);
xfrm_put_type(x->type); xfrm_put_type(x->type);
}
kfree(x); kfree(x);
wake_up(&km_waitq);
} }
static void xfrm_state_gc_task(void *data) static void xfrm_state_gc_task(void *data)
...@@ -196,11 +199,8 @@ void __xfrm_state_destroy(struct xfrm_state *x) ...@@ -196,11 +199,8 @@ void __xfrm_state_destroy(struct xfrm_state *x)
static void __xfrm_state_delete(struct xfrm_state *x) static void __xfrm_state_delete(struct xfrm_state *x)
{ {
int kill = 0;
if (x->km.state != XFRM_STATE_DEAD) { if (x->km.state != XFRM_STATE_DEAD) {
x->km.state = XFRM_STATE_DEAD; x->km.state = XFRM_STATE_DEAD;
kill = 1;
spin_lock(&xfrm_state_lock); spin_lock(&xfrm_state_lock);
list_del(&x->bydst); list_del(&x->bydst);
atomic_dec(&x->refcnt); atomic_dec(&x->refcnt);
...@@ -219,22 +219,17 @@ static void __xfrm_state_delete(struct xfrm_state *x) ...@@ -219,22 +219,17 @@ static void __xfrm_state_delete(struct xfrm_state *x)
*/ */
if (atomic_read(&x->refcnt) > 2) if (atomic_read(&x->refcnt) > 2)
xfrm_flush_bundles(x); xfrm_flush_bundles(x);
}
/* All xfrm_state objects are created by one of two possible /* All xfrm_state objects are created by one of two possible
* paths: * paths:
* *
* 1) xfrm_state_alloc --> xfrm_state_insert * 2) xfrm_state_lookup --> xfrm_state_insert
* 2) xfrm_state_lookup --> xfrm_state_insert *
* * The xfrm_state_lookup or xfrm_state_alloc call gives a
* The xfrm_state_lookup or xfrm_state_alloc call gives a * reference, and that is what we are dropping here.
* reference, and that is what we are dropping here. */
*/ atomic_dec(&x->refcnt);
atomic_dec(&x->refcnt); }
if (kill && x->type)
x->type->destructor(x);
wake_up(&km_waitq);
} }
void xfrm_state_delete(struct xfrm_state *x) void xfrm_state_delete(struct xfrm_state *x)
......
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