[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAPcyv4iPCwRCun_w+dE7P86KUC73f6G++sSUS4BFzBzDcsBOpw@mail.gmail.com>
Date: Mon, 10 Sep 2018 23:02:11 -0700
From: Dan Williams <dan.j.williams@...el.com>
To: Dave Jiang <dave.jiang@...el.com>
Cc: Stefan Hajnoczi <stefanha@...hat.com>,
linux-nvdimm <linux-nvdimm@...ts.01.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Ross Zwisler <ross.zwisler@...ux.intel.com>,
Vishal Verma <vishal.l.verma@...el.com>
Subject: Re: [PATCH] device-dax: avoid hang on error before devm_memremap_pages()
On Tue, Jul 31, 2018 at 5:26 PM, Dave Jiang <dave.jiang@...el.com> wrote:
>
>
> On 7/31/2018 7:32 AM, Stefan Hajnoczi wrote:
>>
>> dax_pmem_percpu_exit() waits for dax_pmem_percpu_release() to invoke the
>> dax_pmem->cmp completion. Unfortunately this approach to cleaning up
>> the percpu_ref only works after devm_memremap_pages() was successful.
>>
>> If devm_add_action_or_reset() or devm_memremap_pages() fails,
>> dax_pmem_percpu_release() is not invoked. Therefore
>> dax_pmem_percpu_exit() hangs waiting for the completion:
>>
>> rc = devm_add_action_or_reset(dev, dax_pmem_percpu_exit,
>> &dax_pmem->ref);
>> if (rc)
>> return rc;
>>
>> dax_pmem->pgmap.ref = &dax_pmem->ref;
>> addr = devm_memremap_pages(dev, &dax_pmem->pgmap);
>>
>> Avoid the hang by calling percpu_ref_exit() in the error paths instead
>> of going through dax_pmem_percpu_exit().
>>
>> Signed-off-by: Stefan Hajnoczi <stefanha@...hat.com>
>
>
> Applied
>
A similar problem exists in other devm_memremap_pages() users. I had a
more comprehensive fix in-flight that I will rebase on top of this
change.
https://lore.kernel.org/patchwork/patch/961576/
Powered by blists - more mailing lists