[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v3 02/11] tmem: Add ASSERT in obj_rb_insert for pool->rwlock lock.



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@xxxxxxxxxx>
Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 xen/common/tmem.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/common/tmem.c b/xen/common/tmem.c
index ed9b975..c1ffe79 100644
--- a/xen/common/tmem.c
+++ b/xen/common/tmem.c
@@ -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 && obj->pool != NULL);
+    ASSERT_WRITELOCK(&obj->pool->pool_rwlock);
+
     new = &(root->rb_node);
     while ( *new )
     {
-- 
2.1.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.