Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E872CC433DF for ; Wed, 5 Aug 2020 18:32:10 +0000 (UTC) Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ACBAB22D08 for ; Wed, 5 Aug 2020 18:32:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nq9nPjDT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ACBAB22D08 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kernelnewbies-bounces@kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.94) (envelope-from ) id 1k3OBw-0001y3-Qp; Wed, 05 Aug 2020 14:31:08 -0400 Received: from mail-oi1-x243.google.com ([2607:f8b0:4864:20::243]) by shelob.surriel.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94) (envelope-from ) id 1k3OBf-0001vW-3b for kernelnewbies@kernelnewbies.org; Wed, 05 Aug 2020 14:30:51 -0400 Received: by mail-oi1-x243.google.com with SMTP id z22so9894697oid.1 for ; Wed, 05 Aug 2020 11:30:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lvIDYiUK7gDXV/zoUhxO0yQ8O7iWJyBFcYJ5t8V1huk=; b=nq9nPjDTdWSpJ7OD1hWlIpNbjsG7pJ+WiE73k294JFsBchKprXY7gqsgXeREiHyih6 l2VwBb2HiqL48r7NoA9bi9aHYl7mN5l7xgH/472t87oUq6+regqzdmn5Vkal7FgiCm5L hZ5zay8jVyr5aWbv4qjHNM4kcRbvScZzELozFidr4y9jojricQFaDsBv98ngcNI4BU11 f3EUaicFdq+Xa2Ye17aRi9uMLO/b+igheoY95K72hLY23TDjXeYOdGnrsKytvGs1EEIS VsYJLb11X7RNgJfQPYVveEVvjxXpy9lMuIAbT9abkpvm/7JTUwkIwNVIfISkKwxbVXcY VLcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lvIDYiUK7gDXV/zoUhxO0yQ8O7iWJyBFcYJ5t8V1huk=; b=gNHq90NipamjHNVV7unJp5yEy6XSPHjcQmUBOPnaWPm2m2UtvFY6PNwWYoVUA6OjiK 3QF1FNvZ9Alsfcc2Z6gyx7RPkh+5sIhkA5qYnYiHN4LixMYoFHs19W8I08Y7KjdG3r94 vbiyq8wzLgZ4A2Kxn8o9yTwkpHGhAVUhiaQ39LZXB/eHRXmt5hsG3eI7yyaEnpSOMlOe 9bEHTVxetMPaoh/G8nj4cs8g6d+YShQdoIQyNeYuFmJ9oz4yE1N13pYX5MU8S/iPBID2 jEPOSEziSA6mOCLhqify0hfoiAMne48chJIkbBdjYeILNuBX9whWUxcCOy1btc99b6ws 6vSg== X-Gm-Message-State: AOAM530U6m0sAD81W/wyA6cbuAfIihHmhnhi7z8NRBAI8w9GsmR+21M0 sQD8MvOY75mwn+b0QDQcfJY= X-Google-Smtp-Source: ABdhPJxP+hL3GiA5UM87l15KjbOC+ZJbkMBdlUdbYlUeAuydIuWYVPCF1YBgiskV8TWBIg6cJpfC9w== X-Received: by 2002:aca:3c43:: with SMTP id j64mr3718525oia.178.1596652247662; Wed, 05 Aug 2020 11:30:47 -0700 (PDT) Received: from frodo.hsd1.co.comcast.net ([2601:284:8204:6ba0::1eb0]) by smtp.googlemail.com with ESMTPSA id t83sm596948oot.22.2020.08.05.11.30.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2020 11:30:46 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com Subject: [PATCH 6/8] dyndbg: ddebug_zpool_remove Date: Wed, 5 Aug 2020 12:30:21 -0600 Message-Id: <20200805183023.586590-7-jim.cromie@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200805183023.586590-1-jim.cromie@gmail.com> References: <20200805183023.586590-1-jim.cromie@gmail.com> MIME-Version: 1.0 Cc: Jim Cromie , kernelnewbies@kernelnewbies.org X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kernelnewbies-bounces@kernelnewbies.org add ddebug_zpool_remove() to undo ddebug_zpool_add(), and call it from ddebug_remove_module(). Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 049299027fb3..102f47b2a439 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -1007,6 +1007,18 @@ static void ddebug_zpool_add(struct _ddebug *dp) zs_unmap_object(dd_callsite_zpool, handle); } +static void ddebug_zpool_remove(struct _ddebug *dp) +{ + if (dp->site) { + pr_warn("zhandle shouldnt be mapped now\n"); + zs_unmap_object(dd_callsite_zpool, dp->zhandle); + } + if (!dp->zhandle) + pr_err("zhandle already cleared !\n"); + else + zs_free(dd_callsite_zpool, dp->zhandle); +} + /* * Allocate a new ddebug_table for the given module * and add it to the global list. @@ -1104,6 +1116,13 @@ int ddebug_remove_module(const char *mod_name) mutex_lock(&ddebug_lock); list_for_each_entry_safe(dt, nextdt, &ddebug_tables, link) { if (dt->mod_name == mod_name) { + + unsigned int n = dt->num_ddebugs; + struct _ddebug *dp = dt->ddebugs; + + for (; n; n--, dp++) + ddebug_zpool_remove(dp); + ddebug_table_free(dt); ret = 0; break; -- 2.26.2 _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies