Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1091802imm; Fri, 28 Sep 2018 11:48:59 -0700 (PDT) X-Google-Smtp-Source: ACcGV61bWVOLvZya2XVcNOhEwbSuqf9FD1D0vDKTk4+iDiH5IHB4CZkKfZwfX1X+Ykd9o6jBEpwT X-Received: by 2002:a63:2323:: with SMTP id j35-v6mr16500349pgj.337.1538160539391; Fri, 28 Sep 2018 11:48:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538160539; cv=none; d=google.com; s=arc-20160816; b=FiFhGgG8a6gkQyr9SoYPBUChNP7i9axK7dAba/jTG2OUi7Q65bQaWK3ZH8YQf1bwPz n/R/1s2UeB9j0/QJx/ovEfzWFB/zoWX54ncjWX11TB5rpkgXm1gzmxoK3aUaRYLEjbPd 5cra5sXs9RkL6BcbfkDEWFLK3nhZg/KVTfhAhcP5ZzRGMwmRsIpzuRtO1W8VXG6OAPem Rq4x8U8uNdqpNSkyaVoHvuRFp0lyRV9fAIROAu1xKXjyPnZ8LsNA/ICq6/WKFbncySEZ PrLRSshjKA0+JXmy5Uh6CwWj64kvpYGGQnHAueW0yZ0UQYIHZrwbl0VEYJZ+30IZtJdC y34A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject; bh=RTbhLvGtN/tl/+eoEnZddqDSYSQBOjQJ2ept9ivL6So=; b=G0JLqPbbXZ/n/b2qZFBPdxB7IvaKs5JUhm45pVxZEpRj+9LtNLuuj01dgxGqRoGZ2v qZZvqd/9Qbv/Ii3zvYYf1UxVK80O4ZtZG92FRcBgsamK3CXFl0pZ4asw1CBHnv73gGBa O0x+JRaaE9c8M2WAIFcpjY4c3+5sa5U7jlLIvCP7cPWMsFEdzgwqIH+hIfvduP/cPB21 +MX3HFg45WgNw4MSdS4HU4XykKHgh0cGvH/8CBb1g9gr0Em9ZEhvhebNvCGQk7ft3hz8 yzD8uRZRthAhZimNqWKXgr1J4oDU9cnoRv1Zz+oQgJ+FKXixy+Zkipl97Z7JSKN/24vH oXbw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o16-v6si1417980pgj.592.2018.09.28.11.48.42; Fri, 28 Sep 2018 11:48:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726337AbeI2BNm (ORCPT + 99 others); Fri, 28 Sep 2018 21:13:42 -0400 Received: from mga11.intel.com ([192.55.52.93]:45373 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726150AbeI2BNm (ORCPT ); Fri, 28 Sep 2018 21:13:42 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Sep 2018 11:48:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,316,1534834800"; d="scan'208";a="76937571" Received: from djiang5-desk3.ch.intel.com ([143.182.136.93]) by orsmga007.jf.intel.com with ESMTP; 28 Sep 2018 11:47:24 -0700 Subject: Re: [PATCH] libnvdimm, region: Fail badblocks listing for inactive regions To: Dan Williams , linux-nvdimm@lists.01.org Cc: stable@vger.kernel.org, Johannes Thumshirn , linux-kernel@vger.kernel.org References: <153815785702.2023323.12153027860843602654.stgit@dwillia2-desk3.amr.corp.intel.com> From: Dave Jiang Openpgp: preference=signencrypt Autocrypt: addr=dave.jiang@intel.com; prefer-encrypt=mutual; keydata= xsPuBE6TbysRDACKOBHZT4ez/3/idMBVQP+cMIJAWfTTLqbHVYLdHMHh4h6IXWLqWgc9AYTx /ajdOrBVGSK9kMuvqRi0iRO1QLOMUAIc2n/44vh/3Fe54QYfgbndeXhHZi7YEwjiTCbpQ336 pS0rS2qQaA8GzFwu96OslLI05j9Ygaqy73qmuk3wxomIYiu9a97aN3oVv1RyTp6gJK1NWT3J On17P1yWUYPvY3KJtpVqnRLkLZeOIiOahgf9+qiYqPhKQI1Ycx4YhbqkNmDG1VqdMtEWREZO DpTti6oecydN37MW1Y+YSzWYDVLWfoLUr2tBveGCRLf/U2n+Tm2PlJR0IZq+BhtuIUVcRLQW vI+XenR8j3vHVNHs9UXW/FPB8Xb5fwY2bJniZ+B4G67nwelhMNWe7H9IcEaI7Eo32fZk+9fo x6GDAhdT0pEetwuhkmI0YYD7cQj1mEx1oEbzX2p/HRW9sHTSv0V2zKbkPvii3qgvCoDb1uLd 4661UoSG0CYaAx8TwBxUqjsBAO9FXDhLHZJadyHmWp64xQGnNgBathuqoSsIWgQWBpfhDACA OYftX52Wp4qc3ZT06NPzGTV35xr4DVftxxUHiwzB/bzARfK8tdoW4A44gN3P03DAu+UqLoqm UP/e8gSLEjoaebjMu8c2iuOhk1ayHkDPc2gugTgLLBWPkhvIEV4rUV9C7TsgAAvNNDAe8X00 Tu1m01A4ToLpYsNWEtM9ZRdKXSo6YS45DFRhel29ZRz24j4ZNIxN9Bee/fn7FrL4HgO01yH+ QULDAtU87AkVoBdU5xBJVj7tGosuV+ia4UCWXjTzb+ERek2503OvNq4xqche3RM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QDzMV5RyTtpWI7PwIh5IZ 0h4OV2yQHFVViHi6lubCRypQYiMzTmEKua3LeBGvUR9vVmpPJZ/UP6VajKqywjPHYBwLAAMF A/9B/PdGc1sZHno0ezuwZO2J9BOsvASNUzamO9to5P9VHTA6UqRvyfXJpNxLF1HjT4ax7Xn4 wGr6V1DCG3JYBmwIZjfinrLINKEK43L+sLbVVi8Mypc32HhNx/cPewROY2vPb4U7y3jhPBtt lt0ZMb75Lh7zY3TnGLOx1AEzmqwZSMJhBBgRCAAJBQJOk28rAhsMAAoJEGQVxPFmo7k+qiUB AKH0QWC+BBBn3pa9tzOz5hTrup+GIzf5TcuCsiAjISEqAPkBTGk5iiGrrHkxsz8VulDVpNxk o6nmKbYpUAltQObU2w== Message-ID: Date: Fri, 28 Sep 2018 11:47:24 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <153815785702.2023323.12153027860843602654.stgit@dwillia2-desk3.amr.corp.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/28/2018 11:04 AM, Dan Williams wrote: > While experimenting with region driver loading the following backtrace > was triggered: > > INFO: trying to register non-static key. > the code is fine but needs lockdep annotation. > turning off the locking correctness validator. > [..] > Call Trace: > dump_stack+0x85/0xcb > register_lock_class+0x571/0x580 > ? __lock_acquire+0x2ba/0x1310 > ? kernfs_seq_start+0x2a/0x80 > __lock_acquire+0xd4/0x1310 > ? dev_attr_show+0x1c/0x50 > ? __lock_acquire+0x2ba/0x1310 > ? kernfs_seq_start+0x2a/0x80 > ? lock_acquire+0x9e/0x1a0 > lock_acquire+0x9e/0x1a0 > ? dev_attr_show+0x1c/0x50 > badblocks_show+0x70/0x190 > ? dev_attr_show+0x1c/0x50 > dev_attr_show+0x1c/0x50 > > This results from a missing successful call to devm_init_badblocks() > from nd_region_probe(). Block attempts to show badblocks while the > region is not enabled. > > Fixes: 6a6bef90425e ("libnvdimm: add mechanism to publish badblocks...") > Cc: > Cc: Dave Jiang > Cc: Johannes Thumshirn > Signed-off-by: Dan Williams Reviewed-by: Dave Jiang > --- > drivers/nvdimm/region_devs.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c > index fa37afcd43ff..174a418cb171 100644 > --- a/drivers/nvdimm/region_devs.c > +++ b/drivers/nvdimm/region_devs.c > @@ -560,10 +560,17 @@ static ssize_t region_badblocks_show(struct device *dev, > struct device_attribute *attr, char *buf) > { > struct nd_region *nd_region = to_nd_region(dev); > + ssize_t rc; > > - return badblocks_show(&nd_region->bb, buf, 0); > -} > + device_lock(dev); > + if (dev->driver) > + rc = badblocks_show(&nd_region->bb, buf, 0); > + else > + rc = -ENXIO; > + device_unlock(dev); > > + return rc; > +} > static DEVICE_ATTR(badblocks, 0444, region_badblocks_show, NULL); > > static ssize_t resource_show(struct device *dev, >