Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2997378AbdD1W3a (ORCPT ); Fri, 28 Apr 2017 18:29:30 -0400 Received: from g9t5009.houston.hpe.com ([15.241.48.73]:60537 "EHLO g9t5009.houston.hpe.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1035215AbdD1W3X (ORCPT ); Fri, 28 Apr 2017 18:29:23 -0400 X-Greylist: delayed 84701 seconds by postgrey-1.27 at vger.kernel.org; Fri, 28 Apr 2017 18:29:22 EDT From: "Kani, Toshimitsu" To: "dan.j.williams@intel.com" CC: "linux-kernel@vger.kernel.org" , "dave.jiang@intel.com" , "linux-nvdimm@lists.01.org" , "vishal.l.verma@intel.com" Subject: Re: [PATCH 1/2] libnvdimm: fix clear length of nvdimm_forget_poison() Thread-Topic: [PATCH 1/2] libnvdimm: fix clear length of nvdimm_forget_poison() Thread-Index: AQHSv6m7gGeP0lAs30ynvJerDiEMOqHbUueAgAALW4A= Date: Fri, 28 Apr 2017 22:29:16 +0000 Message-ID: <1493418523.30303.6.camel@hpe.com> References: <20170427225706.26791-1-toshi.kani@hpe.com> In-Reply-To: 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.163.8] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;AT5PR84MB0260;7:znRJ3Kf8lU2Zh/F7PDU2gnd31T6cWFpkI6HBmVfUQzFwc2SM+ZgguLUSc3eZj/Jg2nyBo+Zkgep6sGeio4xQTZf3EFr1jyAANkQ+rwOY4hA5xtqYw4yAbaXhzzAmym+DBURAVQX8uZVyt0cbqAPnum3hfaaFHOoU7ku4pe3EZx8Q5fMMl3D6kVN4b4yFQVrfw36U80Sf0gB2Ylf1PhFHRhwOpwuFXwD9xhCjWg4LAdUjxErhdBm8IFDNu9qa1l7+2YQA4SG6OYE9uvk0TBlzOmv1Dn9yA7vI8oxvvue1GyH7hBiLRq1ohim9629mtWZ84R94BD9pGK2pnrD8yiWlTQ== x-ms-office365-filtering-correlation-id: c4347eac-3c00-4821-1848-08d48e860190 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254075)(48565401081)(201703131423075)(201703031133081);SRVR:AT5PR84MB0260; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(227479698468861)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3002001)(6055026)(6041248)(20161123560025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123555025)(20161123562025)(6072148);SRVR:AT5PR84MB0260;BCL:0;PCL:0;RULEID:;SRVR:AT5PR84MB0260; x-forefront-prvs: 029174C036 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(39410400002)(39840400002)(39860400002)(39450400003)(39850400002)(39400400002)(377454003)(24454002)(377424004)(305945005)(7736002)(103116003)(229853002)(2501003)(2351001)(5660300001)(122556002)(8936002)(8676002)(6436002)(86362001)(81166006)(5640700003)(2906002)(6512007)(54906002)(6246003)(3846002)(102836003)(2900100001)(4326008)(36756003)(53936002)(6506006)(54356999)(3660700001)(50986999)(3280700002)(76176999)(53546009)(25786009)(6486002)(6916009)(2950100002)(77096006)(189998001)(38730400002)(66066001)(33646002)(6116002);DIR:OUT;SFP:1102;SCL:1;SRVR:AT5PR84MB0260;H:AT5PR84MB0260.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: MIME-Version: 1.0 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Apr 2017 22:29:16.8283 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-Transport-CrossTenantHeadersStamped: AT5PR84MB0260 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 v3SMTpiS031540 Content-Length: 1710 Lines: 47 On Fri, 2017-04-28 at 14:48 -0700, Dan Williams wrote: > On Thu, Apr 27, 2017 at 3:57 PM, Toshi Kani > wrote: > > ND_CMD_CLEAR_ERROR command returns 'clear_err.cleared', the length > > of error actually cleared, which may be smaller than its requested > > 'len'. > > > > Change nvdimm_clear_poison() to call nvdimm_forget_poison() with > > 'clear_err.cleared' when this value is valid. > > > > Signed-off-by: Toshi Kani > > Cc: Dan Williams > > Cc: Dave Jiang > > Cc: Vishal Verma > > --- > > Based on 'libnvdimm-for-next'. > > --- > >  drivers/nvdimm/bus.c |    4 +++- > >  1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c > > index d214ac44..43ddfd4 100644 > > --- a/drivers/nvdimm/bus.c > > +++ b/drivers/nvdimm/bus.c > > @@ -219,7 +219,9 @@ long nvdimm_clear_poison(struct device *dev, > > phys_addr_t phys, > >         if (cmd_rc < 0) > >                 return cmd_rc; > > > > -       nvdimm_forget_poison(nvdimm_bus, phys, len); > > +       if (clear_err.cleared > 0) > > +               nvdimm_forget_poison(nvdimm_bus, phys, > > clear_err.cleared); > > + > >         return clear_err.cleared; > > Looks, good we need to mark this for -stable since the bug is also > present in current mainline. > > Fixes: e046114af5fc ("libnvdimm: clear the internal poison_list when > clearing badblocks") Shall I send a patch based on the current mainline with cc to -stable? The func name is nvdimm_clear_from_poison_list() in the mainline. Thanks, -Toshi