From: Konrad Rzeszutek Wilk Subject: [PATCH v2 2/8] tmem: Add ASSERT in obj_rb_insert for pool->rwlock lock. Date: Thu, 27 Aug 2015 07:01:57 -0400 Message-ID: <1440673323-6648-3-git-send-email-konrad.wilk@oracle.com> References: <1440673323-6648-1-git-send-email-konrad.wilk@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZUuwk-00033M-5T for xen-devel@lists.xenproject.org; Thu, 27 Aug 2015 11:02:18 +0000 In-Reply-To: <1440673323-6648-1-git-send-email-konrad.wilk@oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org, jbeulich@suse.com, andrew.cooper3@citrix.com, wei.liu2@citrix.com Cc: Konrad Rzeszutek Wilk List-Id: xen-devel@lists.xenproject.org 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 --- xen/common/tmem.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xen/common/tmem.c b/xen/common/tmem.c index 572944e..567ccc5 100644 --- a/xen/common/tmem.c +++ b/xen/common/tmem.c @@ -915,6 +915,11 @@ 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; + struct tmem_pool *pool; + + pool = obj->pool; + ASSERT(pool != NULL); + ASSERT_WRITELOCK(&pool->pool_rwlock); new = &(root->rb_node); while ( *new ) -- 2.1.0