From patchwork Sat Jun 2 17:45:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 10446103 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id ED492600CA for ; Mon, 4 Jun 2018 08:35:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DEC6428B38 for ; Mon, 4 Jun 2018 08:35:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D3A0728B94; Mon, 4 Jun 2018 08:35:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 860B128B38 for ; Mon, 4 Jun 2018 08:35:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9DBC030BDE5E; Mon, 4 Jun 2018 08:35:27 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 63F41600CC; Mon, 4 Jun 2018 08:35:27 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1FC5A18033F2; Mon, 4 Jun 2018 08:35:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w52Hk16d010581 for ; Sat, 2 Jun 2018 13:46:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id CA9459A43A; Sat, 2 Jun 2018 17:46:01 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E53A19A433; Sat, 2 Jun 2018 17:45:56 +0000 (UTC) Received: from mail-qt0-f194.google.com (mail-qt0-f194.google.com [209.85.216.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7183A116C98; Sat, 2 Jun 2018 17:45:45 +0000 (UTC) Received: by mail-qt0-f194.google.com with SMTP id i18-v6so25430017qtp.12; Sat, 02 Jun 2018 10:45:45 -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; bh=keNNJB9CXMxTfVxvvwl5zPJ/NeUjn0xQSA1nCGYl2Qc=; b=omdGx63UXySq89v19NZkKw87GJvjdsXbokqTC91fDRVIHkiUl6OYBc6AsJ6+6pZyuV 5at0HaWA064exY/WkMmgCcyHUQx+2944pFP+rRzlADB0YgQS+xlOEvMguQP/BCvtwIIT +G96gSs/Ikzt+4vJFSasiZKSoKdMmQ3l5XJqTJ5vcPvZAqgrJpz2t9Opm2k9icVF04ow s6RLo00oStN/AadQWKSRNiooKt+GBT49PXNTOcdx3oBTUBTH93fRKOeo7b+jyQIlVtKd jlLLBobHXVJR2KRacxHZ7FLNffyY80gWmYhOubNQoeDolmprHErvIv+CPAUjKh2ajbGK vIKA== 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; bh=keNNJB9CXMxTfVxvvwl5zPJ/NeUjn0xQSA1nCGYl2Qc=; b=khsnSVA/I2FgCJQCuyQ19gHHYAGsi3N7Npiq9gP+/BrR6knu32EczI6/XxJpR3Q3Gk K1Iw9V+T0mW6XF8RuP2uRb8OWlFEwPjg4USjdPO8r+BDW6335mNaKX7WvSixYfbkr7qG inoB1s2SOeWfaQAoKtn7oHsbfF5t1Sla8YpkHkAznCITkvEQ7ohnMxnlf+jgAKYI2XP5 uerHtr150kNZEOA+tJXkYLQ86GIFH6/Dc3pcIqy287/DiCKVzX0VIt1af5gS4Baw105m NaoWyjkyhRFWUKuXhL07NZpefQ6D3eVtfvRPENBp9YdiI8tWskfJR2/m/NpWDFgV6gMS dWlw== X-Gm-Message-State: APt69E1EJOdNDTPVnF3UjLi5RNbUiQpzCn7QDccHahBy2O27HdpYDwPu BntvF+C85b1V2r7DHFUg6CFMk2o= X-Google-Smtp-Source: ADUXVKJUe6JBmPWGq4ungX6LNZSriqJK2MRHWzwISxyDEyKVRPkmb3ylmr4sHpMydLcInHz9WKVNOQ== X-Received: by 2002:ac8:316e:: with SMTP id h43-v6mr14256187qtb.146.1527961544683; Sat, 02 Jun 2018 10:45:44 -0700 (PDT) Received: from localhost.localdomain (c-71-234-172-214.hsd1.vt.comcast.net. [71.234.172.214]) by smtp.gmail.com with ESMTPSA id j125-v6sm27409080qkc.58.2018.06.02.10.45.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 02 Jun 2018 10:45:43 -0700 (PDT) From: Kent Overstreet To: axboe@kernel.dk, dm-devel@redhat.com, linux-kernel@vger.kernel.org, snitzer@redhat.com Date: Sat, 2 Jun 2018 13:45:04 -0400 Message-Id: <20180602174504.1847-1-kent.overstreet@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Sat, 02 Jun 2018 17:45:45 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Sat, 02 Jun 2018 17:45:45 +0000 (UTC) for IP:'209.85.216.194' DOMAIN:'mail-qt0-f194.google.com' HELO:'mail-qt0-f194.google.com' FROM:'kent.overstreet@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.281 * (DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS, T_DKIM_INVALID) 209.85.216.194 mail-qt0-f194.google.com 209.85.216.194 mail-qt0-f194.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Mon, 04 Jun 2018 04:34:54 -0400 Cc: Kent Overstreet Subject: [dm-devel] [PATCH] dm-crypt: fix warning in shutdown path X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Mon, 04 Jun 2018 08:35:28 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP The counter for the number of allocated pages includes pages in the mempool's reserve, so checking that the number of allocated pages is 0 needs to happen after we exit the mempool. Signed-off-by: Kent Overstreet Tested-by: Krzysztof Kozlowski --- drivers/md/dm-crypt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index eaf6b279ac..9a000aa955 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -2221,14 +2221,14 @@ static void crypt_dtr(struct dm_target *ti) bioset_exit(&cc->bs); - if (mempool_initialized(&cc->page_pool)) - WARN_ON(percpu_counter_sum(&cc->n_allocated_pages) != 0); - percpu_counter_destroy(&cc->n_allocated_pages); - mempool_exit(&cc->page_pool); mempool_exit(&cc->req_pool); mempool_exit(&cc->tag_pool); + if (cc->n_allocated_pages.counters) + WARN_ON(percpu_counter_sum(&cc->n_allocated_pages) != 0); + percpu_counter_destroy(&cc->n_allocated_pages); + if (cc->iv_gen_ops && cc->iv_gen_ops->dtr) cc->iv_gen_ops->dtr(cc);