tmem: add matching unlock for an about-to-be-destroyed object
authorDan Magenheimer <dan.magenheimer@oracle.com>
Fri, 31 Aug 2012 20:13:39 +0000 (21:13 +0100)
committerDan Magenheimer <dan.magenheimer@oracle.com>
Fri, 31 Aug 2012 20:13:39 +0000 (21:13 +0100)
A 4.2 changeset forces a preempt_disable/enable with
every lock/unlock.

Tmem has dynamically allocated "objects" that contain a
lock.  The lock is held when the object is destroyed.
No reason to unlock something that's about to be destroyed!
But with the preempt_enable/disable in the generic locking code,
and the fact that do_softirq ASSERTs that preempt_count
must be zero, a crash occurs soon after any object is
destroyed.

So force lock to be released before destroying objects.

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Committed-by: Keir Fraser <keir@xen.org>
xen/common/tmem.c

index dd276df327c7317e9ac75161c7474f54e4877ff0..1a8777c2842a3fd9fec4d092bc98ce141e8aaab6 100644 (file)
@@ -952,6 +952,7 @@ static NOINLINE void obj_free(obj_t *obj, int no_rebalance)
     /* use no_rebalance only if all objects are being destroyed anyway */
     if ( !no_rebalance )
         rb_erase(&obj->rb_tree_node,&pool->obj_rb_root[oid_hash(&old_oid)]);
+    tmem_spin_unlock(&obj->obj_spinlock);
     tmem_free(obj,sizeof(obj_t),pool);
 }