From patchwork Thu Jun 19 14:50:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 4384161 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D930FBEEAA for ; Thu, 19 Jun 2014 14:52:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1C0AC20384 for ; Thu, 19 Jun 2014 14:52:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1E48220394 for ; Thu, 19 Jun 2014 14:52:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932138AbaFSOw3 (ORCPT ); Thu, 19 Jun 2014 10:52:29 -0400 Received: from mail-qg0-f53.google.com ([209.85.192.53]:41909 "EHLO mail-qg0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932083AbaFSOw3 (ORCPT ); Thu, 19 Jun 2014 10:52:29 -0400 Received: by mail-qg0-f53.google.com with SMTP id i50so2170495qgf.40 for ; Thu, 19 Jun 2014 07:52:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=gPlNHBaoumtaAlw0CjzBBJli5hWKModzFHfaC7EY8vU=; b=U9tVCImtF9aivxvG9drKYiNEK4hucmBLzsp9vDpt/mbKCBDYwke3Gry81AS6tCqXpT j0rdTABpiUBJJpVpBMJg5KV6dXaUqq8tHUU5RaZbL/Zq6Yz2lFVMIAfGkFeO9yMv8Uxt wiJq4E5y8jcnCuv8sV/ObL9EcVTS68ycBoFQB1MO7qzVqiRO5Y4eKfa0/OWUPtHGkhQK A/34DQSgWwtQPicJE0CzzRX5CC+tck7tamUMbaSVXee4MUMbGMi9EhMkVEQ3oHNPojRu dJGoVy7FZF3IbLjg8SO9d1zNXUpXBEFpXYG8oD25quoUmqsVFlBUYFBLziaNZLdzY5hn 2VRA== X-Gm-Message-State: ALoCoQm9ceZzUWR7tTpoxIKlGVLryrxM0S2bqzuc23lDtLGh8a6+8W1C4/tTJK6S42lCm631V81f X-Received: by 10.140.81.74 with SMTP id e68mr7232435qgd.77.1403189548169; Thu, 19 Jun 2014 07:52:28 -0700 (PDT) Received: from tlielax.poochiereds.net (cpe-107-015-124-230.nc.res.rr.com. [107.15.124.230]) by mx.google.com with ESMTPSA id r60sm3364044qgd.26.2014.06.19.07.52.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jun 2014 07:52:27 -0700 (PDT) From: Jeff Layton To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org Subject: [PATCH v1 062/104] lockdep: add lockdep_assert_not_held Date: Thu, 19 Jun 2014 10:50:08 -0400 Message-Id: <1403189450-18729-63-git-send-email-jlayton@primarydata.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1403189450-18729-1-git-send-email-jlayton@primarydata.com> References: <1403189450-18729-1-git-send-email-jlayton@primarydata.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We currently have the ability to call lockdep_assert_held to throw a warning when a spinlock isn't held in a codepath. There are also times when we'd like to throw a warning when a lock is held (i.e. when there is the potential for deadlock). Signed-off-by: Jeff Layton --- include/linux/lockdep.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index 008388f920d7..ab0cc8e224ee 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h @@ -362,6 +362,10 @@ extern void lockdep_trace_alloc(gfp_t mask); WARN_ON(debug_locks && !lockdep_is_held(l)); \ } while (0) +#define lockdep_assert_not_held(l) do { \ + WARN_ON(debug_locks && lockdep_is_held(l)); \ + } while (0) + #define lockdep_recursing(tsk) ((tsk)->lockdep_recursion) #else /* !CONFIG_LOCKDEP */ @@ -413,6 +417,8 @@ struct lock_class_key { }; #define lockdep_assert_held(l) do { (void)(l); } while (0) +#define lockdep_assert_not_held(l) do { (void)(l); } while (0) + #define lockdep_recursing(tsk) (0) #endif /* !LOCKDEP */