From: Dave Jiang <dave.jiang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: Dan Williams
<dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org
Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 2/6] nfit, address-range-scrub: fix scrub in-progress reporting
Date: Tue, 3 Apr 2018 08:31:01 -0700 [thread overview]
Message-ID: <f4647d2b-dcc9-f54b-7674-2bc96aec10cf@intel.com> (raw)
In-Reply-To: <152273077198.38372.11857145045474104173.stgit-p8uTFz9XbKj2zm6wflaqv1nYeNYlB/vhral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
On 4/2/2018 9:46 PM, Dan Williams wrote:
> There is a small window whereby ARS scan requests can schedule work that
> userspace will miss when polling scrub_show. Hold the init_mutex lock
> over calls to report the status to close this potential escape. Also,
> make sure that requests to cancel the ARS workqueue are treated as an
> idle event.
>
> Cc: <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
> Cc: Vishal Verma <vishal.l.verma-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Fixes: 37b137ff8c83 ("nfit, libnvdimm: allow an ARS scrub...")
> Signed-off-by: Dan Williams <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Reviewed-by: Dave Jiang <dave.jiang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> ---
> drivers/acpi/nfit/core.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
> index ea9f3e727fef..2a1fc3817a81 100644
> --- a/drivers/acpi/nfit/core.c
> +++ b/drivers/acpi/nfit/core.c
> @@ -1249,8 +1249,11 @@ static ssize_t scrub_show(struct device *dev,
> if (nd_desc) {
> struct acpi_nfit_desc *acpi_desc = to_acpi_desc(nd_desc);
>
> + mutex_lock(&acpi_desc->init_mutex);
> rc = sprintf(buf, "%d%s", acpi_desc->scrub_count,
> - (work_busy(&acpi_desc->work)) ? "+\n" : "\n");
> + work_busy(&acpi_desc->work)
> + && !acpi_desc->cancel ? "+\n" : "\n");
> + mutex_unlock(&acpi_desc->init_mutex);
> }
> device_unlock(dev);
> return rc;
>
next prev parent reply other threads:[~2018-04-03 15:31 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-03 4:46 [PATCH 0/6] nfit, address-range-scrub: rework and fixes Dan Williams
[not found] ` <152273076087.38372.4803377088477706610.stgit-p8uTFz9XbKj2zm6wflaqv1nYeNYlB/vhral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2018-04-03 4:46 ` [PATCH 1/6] nfit: fix region registration vs block-data-window ranges Dan Williams
2018-04-03 15:30 ` Dave Jiang
2018-04-03 4:46 ` [PATCH 2/6] nfit, address-range-scrub: fix scrub in-progress reporting Dan Williams
[not found] ` <152273077198.38372.11857145045474104173.stgit-p8uTFz9XbKj2zm6wflaqv1nYeNYlB/vhral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2018-04-03 15:31 ` Dave Jiang [this message]
2018-04-03 4:46 ` [PATCH 3/6] libnvdimm: add an api to cast a 'struct nd_region' to its 'struct device' Dan Williams
[not found] ` <152273077753.38372.6434283957266644623.stgit-p8uTFz9XbKj2zm6wflaqv1nYeNYlB/vhral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2018-04-03 15:31 ` Dave Jiang
2018-04-03 4:46 ` [PATCH 4/6] nfit, address-range-scrub: introduce nfit_spa->ars_state Dan Williams
[not found] ` <152273078267.38372.2191145328822655057.stgit-p8uTFz9XbKj2zm6wflaqv1nYeNYlB/vhral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2018-04-03 15:31 ` Dave Jiang
2018-04-03 4:46 ` [PATCH 5/6] nfit, address-range-scrub: rework and simplify ARS state machine Dan Williams
[not found] ` <152273078779.38372.13062348829183334140.stgit-p8uTFz9XbKj2zm6wflaqv1nYeNYlB/vhral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2018-04-03 15:29 ` Dave Jiang
[not found] ` <f4c0ca57-3c4a-9805-a66a-6a61aec2b108-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2018-04-03 15:33 ` Dan Williams
2018-04-04 16:26 ` Kani, Toshi
[not found] ` <1522859143.2693.296.camel-ZPxbGqLxI0U@public.gmane.org>
2018-04-04 17:08 ` Dan Williams
2018-04-03 4:46 ` [PATCH 6/6] nfit, address-range-scrub: add module option to skip initial ars Dan Williams
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=f4647d2b-dcc9-f54b-7674-2bc96aec10cf@intel.com \
--to=dave.jiang-ral2jqcrhueavxtiumwx3w@public.gmane.org \
--cc=dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org \
--cc=stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/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