From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi0-x242.google.com (mail-oi0-x242.google.com [IPv6:2607:f8b0:4003:c06::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6DEEA2112389B for ; Mon, 10 Sep 2018 23:02:13 -0700 (PDT) Received: by mail-oi0-x242.google.com with SMTP id c190-v6so44915732oig.6 for ; Mon, 10 Sep 2018 23:02:13 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <499a3093-3781-7a8a-abd0-8b240db11dce@intel.com> References: <20180731143246.16915-1-stefanha@redhat.com> <499a3093-3781-7a8a-abd0-8b240db11dce@intel.com> From: Dan Williams Date: Mon, 10 Sep 2018 23:02:11 -0700 Message-ID: Subject: Re: [PATCH] device-dax: avoid hang on error before devm_memremap_pages() List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" To: Dave Jiang Cc: Linux Kernel Mailing List , Stefan Hajnoczi , linux-nvdimm List-ID: On Tue, Jul 31, 2018 at 5:26 PM, Dave Jiang 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 > > > 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/ _______________________________________________ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm