From patchwork Wed Sep 15 21:07:15 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 64905 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id BE7E7B6EF0 for ; Thu, 16 Sep 2010 07:07:48 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755221Ab0IOVHY (ORCPT ); Wed, 15 Sep 2010 17:07:24 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:49854 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755209Ab0IOVHV (ORCPT ); Wed, 15 Sep 2010 17:07:21 -0400 Received: by wyf22 with SMTP id 22so681880wyf.19 for ; Wed, 15 Sep 2010 14:07:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:cc :content-type:date:message-id:mime-version:x-mailer :content-transfer-encoding; bh=yjfAhRBH1eJSZ8fW6cDG5I/4sZw0Ph7CuMAS2aZIZGU=; b=UFpgoioCQwNTwsmSYzfNSh0cV5EMc9KNKuEov0Qc4eHRD7EmlUptxF0J8ew89MbT9Y erG1u0YUn9+2BXSO/mfOwdH8gyIxmyjn+XViNRTryZ6S/W+P+1OmFASi1uiL6/8kXTuC X7AluzZyaHeSQnD8wDzAmhzokF4ekwgeBmwOQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:cc:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; b=MgEItcH0YgLEftNxYzbRC9OAIdLcGVfFuz0UK1IWbadlufCiFaTXAkDmmxASFIaBWO 4p3HTZWLQnftvBcaFFJs3r+EmvrxhsjS7qr7Rcj3T6ACJJiPbSD/0VvfUIgrzKIuLUt3 kiNEqSsEpqRKWv7O2o4BBw4sOcC7+ru4FG1xI= Received: by 10.227.131.68 with SMTP id w4mr1736075wbs.225.1284584840010; Wed, 15 Sep 2010 14:07:20 -0700 (PDT) Received: from [10.150.51.211] (gw0.net.jmsp.net [212.23.165.14]) by mx.google.com with ESMTPS id w31sm1626599wbd.21.2010.09.15.14.07.18 (version=SSLv3 cipher=RC4-MD5); Wed, 15 Sep 2010 14:07:19 -0700 (PDT) Subject: [PATCH net-next-2.6 1/3] net: add rtnl_dereference() From: Eric Dumazet To: David Miller Cc: netdev Date: Wed, 15 Sep 2010 23:07:15 +0200 Message-ID: <1284584835.2462.69.camel@edumazet-laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org We sometime want to dereference an rcu protected pointer while holding RTNL. Use a macro to hide all lockdep details. Signed-off-by: Eric Dumazet --- include/linux/rtnetlink.h | 9 +++++++++ 1 files changed, 9 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index 263690d..68c436b 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h @@ -760,6 +760,15 @@ extern int lockdep_rtnl_is_held(void); rcu_dereference_check(p, rcu_read_lock_held() || \ lockdep_rtnl_is_held()) +/** + * rtnl_dereference - rcu_dereference with debug checking + * @p: The pointer to read, prior to dereferencing + * + * Do an rcu_dereference(p), but check caller holds RTNL + */ +#define rtnl_dereference(p) \ + rcu_dereference_check(p, lockdep_rtnl_is_held()) + extern void rtnetlink_init(void); extern void __rtnl_unlock(void);