All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jiang, Dave" <dave.jiang@intel.com>
To: "Kani, Toshimitsu" <toshi.kani@hpe.com>
Cc: "linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>
Subject: Re: [PATCH v2] ndctl: add clear error support for ndctl
Date: Mon, 1 May 2017 14:02:41 -0700	[thread overview]
Message-ID: <20170501210241.GA11607@djiang5-desk3.ch.intel.com> (raw)
In-Reply-To: <1493670342.30303.24.camel@hpe.com>

On Mon, May 01, 2017 at 01:25:45PM -0700, Kani, Toshimitsu wrote:
> On Thu, 2017-04-27 at 15:38 -0700, Dave Jiang wrote:
> > Adding ndctl support that will allow clearing of bad blocks for a
> > device. Initial implementation will only support device dax devices.
> > The ndctl takes a device path and parameters of the starting bad
> > block, and the number of bad blocks to clear.
> >
> > Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> 
> Hi Dave,
> 
> I am seeing a failure to open "badblocks" on my system since its sysfs
> path with "/sys/devcies/platform/ACPI.NFIT" is not valid (not sure how
> I got "ACPI.NFIT" here - I hope I did not mess up my build with test
> cases).
> 
> As you can see below, other open paths use
> "/sys/devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0012:00/" for "nbus0".  If
> you go from "/sys/devices/platform", a valid path seems to be:
> "/sys/devices/platform/ACPI0012:00/firmware_node"
> 
> # strace ndctl clear-error -f /dev/dax0.0 -s 1048576 -l 1
> execve("/usr/bin/ndctl", ["ndctl", "clear-error", "-f", "/dev/dax0.0",
> "-s", "1048576", "-l", "1"], [/* 60 vars */]) = 0
>  :
> open("/sys/devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0012:00/ndbus0/region0/d
> ax0.0/resource", O_RDONLY|O_CLOEXEC) = 4
> read(4, "0x250200000\n", 1024)          = 12
> close(4)                                = 0
> open("/sys/devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0012:00/ndbus0/region0/d
> ax0.0/size", O_RDONLY|O_CLOEXEC) = 4
> read(4, "16909336576\n", 1024)          = 12
> close(4)                                = 0
> getdents(3, /* 0 entries */, 32768)     = 0
> close(3)                                = 0
> open("/sys/devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0012:00/ndbus0/region0/r
> esource", O_RDONLY|O_CLOEXEC) = 3
> read(3, "0x240000000\n", 1024)          = 12
> close(3)                                = 0
> open("/sys/devices/platform/ACPI.NFIT/ndbus0/region0/badblocks",
> O_RDONLY) = -1 ENOENT (No such file or directory)
> write(2, "libndctl: regions_badblocks_init"..., 34libndctl:
> regions_badblocks_init: ) = 34
> write(2, "region badblocks fopen failed\n", 30region badblocks fopen
> failed
> ) = 30
> exit_group(234)                         = ?
> +++ exited with 234 +++
> 
> Thanks,
> -Toshi

Toshi,
Can you please try this and see if that fixes the issue? Thanks!

diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
index 7399729..44fc2f3 100644
--- a/ndctl/lib/libndctl.c
+++ b/ndctl/lib/libndctl.c
@@ -1882,10 +1882,8 @@ static int regions_badblocks_init(struct ndctl_region *region)
 		region->badblocks = NULL;
 	}
 
-	if (asprintf(&bb_path, "/sys/devices/platform/%s/%s/%s/badblocks",
-				ndctl_bus_get_provider(bus),
-				ndctl_bus_get_devname(bus),
-				ndctl_region_get_devname(region)) < 0) {
+	if (asprintf(&bb_path, "%s/badblocks",
+				region->region_path) < 0) {
 		rc = -errno;
 		err(ctx, "region badblocks path allocation failure\n");
 		return rc;
-- 

Dave Jiang
Software Engineer, Data Center Group
Intel Corp.
dave.jiang@intel.com
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

  reply	other threads:[~2017-05-01 21:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-27 22:38 [PATCH v2] ndctl: add clear error support for ndctl Dave Jiang
2017-05-01 20:25 ` Kani, Toshimitsu
2017-05-01 21:02   ` Jiang, Dave [this message]
2017-05-01 21:12     ` Kani, Toshimitsu
2017-05-01 21:20       ` Dave Jiang

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=20170501210241.GA11607@djiang5-desk3.ch.intel.com \
    --to=dave.jiang@intel.com \
    --cc=linux-nvdimm@lists.01.org \
    --cc=toshi.kani@hpe.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.