Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751983AbdGBTbz (ORCPT ); Sun, 2 Jul 2017 15:31:55 -0400 Received: from g4t3425.houston.hpe.com ([15.241.140.78]:45640 "EHLO g4t3425.houston.hpe.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751849AbdGBTbw (ORCPT ); Sun, 2 Jul 2017 15:31:52 -0400 From: "Kani, Toshimitsu" To: "dan.j.williams@intel.com" , "linux-nvdimm@lists.01.org" CC: "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] libnvdimm, region, pmem: fix 'badblocks' sysfs_get_dirent() reference lifetime Thread-Topic: [PATCH] libnvdimm, region, pmem: fix 'badblocks' sysfs_get_dirent() reference lifetime Thread-Index: AQHS8oK+ynsu+mKl7UesmJueC2+/0qJA7CwA Date: Sun, 2 Jul 2017 19:31:49 +0000 Message-ID: <1499023372.2042.1.camel@hpe.com> References: <149892424300.37698.9888818880178611728.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <149892424300.37698.9888818880178611728.stgit@dwillia2-desk3.amr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=hpe.com; x-originating-ip: [15.219.147.8] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DF4PR84MB0108;7:JCqNhSek3ayAINt46QFozYssB7e4Wc1tzcb5tmWsvyj+M8+Hsr/2TLWMsVUtYeA+4Ao5EDMJbY7DNg6msGvBF8dfWad7Wv2hi+qko4iyoLIjH+mRU91dxq7OS4A//G+Jglx60ZiLxZF2n35pUV1jgzorofO5pZagpuiE4kO5TF4IJoM6oH0p9tNEKzIEUQ9h5llxKxxxmUi/ZYDImMUXdw2bG7fkMKPsOHCllvhQj4XYSO4bkzhnHeGUEkYxTktOWVdbbWml/mKFqdHbqHHBB8NzK9PHL0GCMRcJa8a58r97Aqe5zyX/ZqWL+7H0Qk8/mElFcgOnl+p6E0BLX+Nq8N21/4xzaeRBp1FW2TKRu3Lbth1wseAICzrFRCH9T7wVqySH0fzzwA0fSJUn9nf/hwJ/XVay59HyP8C5xDofjLUfzWwdKlNBNvz4wVU+msf0+8axOxCh76Fi9LhlVLSkDScWDnn2Oh/23q8qt3Qo9jU2+kuePHPvr5ra2445A6Q7v2DN2kdGOjJhW/aDAcbgltSnaxr+1P+0lFDy3IbdcUhgMDiVB3UAf17EbPVO9Pm9pB+GauExN6R7FArg5GQ75EeqHyBRHxkD3xAPWosPKl7rHT6axZqdSyIr0TCvBp4pMjeXBaogOiG3thmec96iqBfYY/jRJ4H7XR0byGzxQDhB1sdu/tcYPLC5U1cObuRAgX3XyjdIhelqm+Ol0N263uKdyJ+gzM66sygg2zg4gfMNynk/r87U0dEvw/Cgkx6BFdtgVCww5bMuXc+hkI6Xl9j+78eOopmJDmqLb9r1i4I= x-ms-office365-filtering-correlation-id: e89358a8-759b-4df8-7248-08d4c180fc05 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254075)(48565401081)(300000503095)(300135400095)(2017052603031)(201703131423075)(201703031133081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:DF4PR84MB0108; x-ms-traffictypediagnostic: DF4PR84MB0108: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(227479698468861)(236129657087228)(148574349560750)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(3002001)(100000703101)(100105400095)(10201501046)(93006095)(93001095)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123562025)(20161123555025)(20161123564025)(20161123560025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:DF4PR84MB0108;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DF4PR84MB0108; x-forefront-prvs: 03569407CC x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(39410400002)(39840400002)(39860400002)(39850400002)(39400400002)(377424004)(24454002)(8936002)(4326008)(3280700002)(86362001)(38730400002)(3660700001)(6246003)(305945005)(478600001)(36756003)(6436002)(5660300001)(3846002)(6512007)(6116002)(66066001)(50986999)(102836003)(53936002)(2900100001)(7736002)(81166006)(2501003)(54356999)(8676002)(76176999)(33646002)(6506006)(6486002)(14454004)(77096006)(2950100002)(189998001)(103116003);DIR:OUT;SFP:1102;SCL:1;SRVR:DF4PR84MB0108;H:DF4PR84MB0105.NAMPRD84.PROD.OUTLOOK.COM;FPR:;SPF:None;MLV:sfv;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="utf-8" Content-ID: <776359EA95546649BFFE74CFCBBF8132@NAMPRD84.PROD.OUTLOOK.COM> MIME-Version: 1.0 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Jul 2017 19:31:49.2866 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-Transport-CrossTenantHeadersStamped: DF4PR84MB0108 X-OriginatorOrg: hpe.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id v62JW0A1031369 Content-Length: 856 Lines: 21 On Sat, 2017-07-01 at 08:50 -0700, Dan Williams wrote: > We need to hold a reference on the 'dirent' until we are sure there > are no more notifications that will be sent. As noted in the new > comments we take advantage of the fact that the references are taken > and dropped under device_lock() and that nd_device_notify() holds > device_lock() over new badblocks notifications. The notifications > that happen when badblocks are cleared only occur while the device is > active. > > Also take the opportunity to fix up the error messages to report the > user visible effect of a sysfs_get_dirent() failure. > > Fixes: 975750a98c26 ("libnvdimm, pmem: Add sysfs notifications to > badblocks") > Cc: Toshi Kani > Signed-off-by: Dan Williams Reviewed-by: Toshi Kani Thanks Dan! -Toshi