]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/xen.git/commitdiff
tmem: Add ASSERT in obj_rb_insert for pool->rwlock lock.
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Fri, 21 Aug 2015 14:49:22 +0000 (10:49 -0400)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Wed, 2 Sep 2015 12:47:59 +0000 (08:47 -0400)
Manipulating the obj-> structures requires us to hold the
pool->rwlock lock. Lets make that obvious in this function to
catch any errant users (none found, but we may in future).

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
xen/common/tmem.c

index ed9b975c094a40c5b92231e8b6fc1df034bfc0e3..6ea602b464e4fffc04e522ca50512d1d3c5bb603 100644 (file)
@@ -916,6 +916,9 @@ static int obj_rb_insert(struct rb_root *root, struct tmem_object_root *obj)
     struct rb_node **new, *parent = NULL;
     struct tmem_object_root *this;
 
+    ASSERT(obj->pool);
+    ASSERT_WRITELOCK(&obj->pool->pool_rwlock);
+
     new = &(root->rb_node);
     while ( *new )
     {