From: Dan Williams <dan.j.williams@intel.com>
To: Vaibhav Jain <vaibhav@linux.ibm.com>
Cc: Linux NVDIMM <nvdimm@lists.linux.dev>,
Vishal Verma <vishal.l.verma@intel.com>,
"Aneesh Kumar K . V" <aneesh.kumar@linux.ibm.com>,
Ira Weiny <ira.weiny@intel.com>,
Shivaprasad G Bhat <sbhat@linux.ibm.com>
Subject: Re: [ndctl PATCH] libndctl: Update nvdimm flags after inject-smart
Date: Tue, 13 Jul 2021 14:06:08 -0700 [thread overview]
Message-ID: <CAPcyv4hnZSzcG3uc0BLWBjhbqBwJLsCeUPiAALwubHoXge58NQ@mail.gmail.com> (raw)
In-Reply-To: <20210713202523.190113-1-vaibhav@linux.ibm.com>
On Tue, Jul 13, 2021 at 1:25 PM Vaibhav Jain <vaibhav@linux.ibm.com> wrote:
>
> Presently after performing a inject-smart the nvdimm flags reported are out
> of date as shown below where no 'smart_notify' or 'flush_fail' flags were
> reported even though they are set after injecting the smart error:
>
> $ sudo inject-smart -fU nmem0
> [
> {
> "dev":"nmem0",
> "health":{
> "health_state":"fatal",
> "shutdown_state":"dirty",
> "shutdown_count":0
> }
> }
> ]
> $ sudo cat /sys/class/nd/ndctl0/device/nmem0/papr/flags
> flush_fail smart_notify
>
> This happens because nvdimm flags are only parsed once during its probe and
> not refreshed even after a inject-smart operation makes them out of
> date. To fix this the patch adds a new export from libndctl named as
> ndctl_refresh_dimm_flags() that can be called after inject-smart that
> forces a refresh of nvdimm flags. This ensures that correct nvdimm flags
> are reported after the inject-smart operation as shown below:
>
> $ sudo ndctl inject-smart -fU nmem0
> [
> {
> "dev":"nmem0",
> "flag_failed_flush":true,
> "flag_smart_event":true,
> "health":{
> "health_state":"fatal",
> "shutdown_state":"dirty",
> "shutdown_count":0
> }
> }
> ]
>
> The patch refactors populate_dimm_attributes() to move the nvdimm flags
> parsing code to the newly introduced ndctl_refresh_dimm_flags()
> export. Since reading nvdimm flags requires constructing path using
> 'bus_prefix' which is only available during add_dimm(), the patch
> introduces a new member 'struct ndctl_dimm.bus_prefix' to cache its
> value. During ndctl_refresh_dimm_flags() the cached bus_prefix is used to
> read the contents of the nvdimm flag file and pass it on to the appropriate
> flag parsing function.
I think this can be handled without needing an explicit
ndctl_refresh_dimm_flags() api. Teach all the flag retrieval apis to
check if the cached value has been invalidated and re-parse the flags.
Then teach the inject-smart path to invalidate the cached copy of the
flags.
next prev parent reply other threads:[~2021-07-13 21:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-13 20:25 [ndctl PATCH] libndctl: Update nvdimm flags after inject-smart Vaibhav Jain
2021-07-13 21:06 ` Dan Williams [this message]
2021-07-14 7:58 ` Vaibhav Jain
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=CAPcyv4hnZSzcG3uc0BLWBjhbqBwJLsCeUPiAALwubHoXge58NQ@mail.gmail.com \
--to=dan.j.williams@intel.com \
--cc=aneesh.kumar@linux.ibm.com \
--cc=ira.weiny@intel.com \
--cc=nvdimm@lists.linux.dev \
--cc=sbhat@linux.ibm.com \
--cc=vaibhav@linux.ibm.com \
--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;
as well as URLs for NNTP newsgroup(s).