mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Kani, Toshimitsu" <toshi.kani@hpe.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: Vishal L Verma <vishal.l.verma@intel.com>,
	"Knippers, Linda" <linda.knippers@hpe.com>,
	"linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH v2] libnvdimm, pmem: Add sysfs notifications to badblocks
Date: Sat, 1 Jul 2017 00:41:32 +0000	[thread overview]
Message-ID: <DF4PR84MB01052029BEB89DF70A067FAC82D00@DF4PR84MB0105.NAMPRD84.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <CAPcyv4gL-C2exjbZDibnFU59S267EEmV8d6uoLtH_RndtvEy=w@mail.gmail.com>

> > Sysfs "badblocks" information may be updated during run-time that:
> >  - MCE, SCI, and sysfs "scrub" may add new bad blocks
> >  - Writes and ioctl() may clear bad blocks
> >
> > Add support to send sysfs notifications to sysfs "badblocks" file
> > under region and pmem directories when their badblocks information
> > is re-evaluated (but is not necessarily changed) during run-time.
> >
> > Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
> > Cc: Dan Williams <dan.j.williams@intel.com>
> > Cc: Vishal Verma <vishal.l.verma@intel.com>
> > Cc: Linda Knippers <linda.knippers@hpe.com>
> > ---
> > v2: Send notifications for the clearing case
> > ---
> >  drivers/nvdimm/bus.c    |    3 +++
> >  drivers/nvdimm/nd.h     |    1 +
> >  drivers/nvdimm/pmem.c   |   14 ++++++++++++++
> >  drivers/nvdimm/pmem.h   |    1 +
> >  drivers/nvdimm/region.c |   12 ++++++++++--
> >  5 files changed, 29 insertions(+), 2 deletions(-)
> >
> [..]
> > diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
> > index c544d46..6c14c72 100644
> > --- a/drivers/nvdimm/pmem.c
> > +++ b/drivers/nvdimm/pmem.c
> [..]
> > @@ -377,6 +379,13 @@ static int pmem_attach_disk(struct device *dev,
> >
> >         revalidate_disk(disk);
> >
> > +       pmem->bb_state = sysfs_get_dirent(disk_to_dev(disk)->kobj.sd,
> > +                                         "badblocks");
> > +       if (pmem->bb_state)
> > +               sysfs_put(pmem->bb_state);
> 
> Sorry I missed this on the first review, but this looks broken. We
> need to hold the reference for as long as we might trigger
> notifications, so the sysfs_put() should wait until
> pmem_release_disk().

I see.
 
> [..]
> > diff --git a/drivers/nvdimm/region.c b/drivers/nvdimm/region.c
> > index 869a886..ca94029 100644
> > --- a/drivers/nvdimm/region.c
> > +++ b/drivers/nvdimm/region.c
> > @@ -58,10 +58,16 @@ static int nd_region_probe(struct device *dev)
> >
> >                 if (devm_init_badblocks(dev, &nd_region->bb))
> >                         return -ENODEV;
> > +               nd_region->bb_state = sysfs_get_dirent(nd_region->dev.kobj.sd,
> > +                                                      "badblocks");
> > +               if (nd_region->bb_state)
> > +                       sysfs_put(nd_region->bb_state);
> 
> ...same here. This should wait until we tear down the region.
> 
> I'll take a look at an incremental fix patch.

Thanks Dan!
-Toshi

      reply	other threads:[~2017-07-01  0:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-12 22:25 Toshi Kani
2017-06-15 21:33 ` Dan Williams
2017-06-17  0:35   ` Kani, Toshimitsu
2017-06-17  0:46     ` Dan Williams
2017-06-17  0:51       ` Kani, Toshimitsu
2017-06-30 16:47 ` Dan Williams
2017-07-01  0:41   ` Kani, Toshimitsu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DF4PR84MB01052029BEB89DF70A067FAC82D00@DF4PR84MB0105.NAMPRD84.PROD.OUTLOOK.COM \
    --to=toshi.kani@hpe.com \
    --cc=dan.j.williams@intel.com \
    --cc=linda.knippers@hpe.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvdimm@lists.01.org \
    --cc=vishal.l.verma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®