From: Konrad Rzeszutek Wilk Subject: [PATCH v3 02/11] tmem: Add ASSERT in obj_rb_insert for pool->rwlock lock. Date: Fri, 28 Aug 2015 14:53:11 -0400 Message-ID: <1440788000-32635-3-git-send-email-konrad.wilk@oracle.com> References: <1440788000-32635-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.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZVOmG-0004KW-TO for xen-devel@lists.xenproject.org; Fri, 28 Aug 2015 18:53:29 +0000 In-Reply-To: <1440788000-32635-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 Reviewed-by: Andrew Cooper Acked-by: Wei Liu --- 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