Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3580247ybi; Mon, 29 Jul 2019 08:59:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqysTkuzVFPT/8h/stt8tjEkNSe5Lyv3A+Hbc+LmwxJ26KH5abDeg01QQCHtuYgTfkYeK1bB X-Received: by 2002:a63:d002:: with SMTP id z2mr107579347pgf.364.1564415961085; Mon, 29 Jul 2019 08:59:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564415961; cv=none; d=google.com; s=arc-20160816; b=WBVpeRwIEa3w7KXyt/beO87cp/9J/S7Ck0jQufMTePrl0gMc4WiDrqoxZDqSr1xODa BZW21CFZKum1MW8ugynLaWJHo5hClcUlI2sE672BfPFLzJTC0hxwV+mW0iYpsWHnkdZY 3xyM/Y0niC1rLOJflJPI0/3dKhahaGbl6wBF+ibjFWXIN6EsXj4m7auU4/IxKKX9hX7J c5j37stEzGuZP/O8JWb1EDU8vd0rtn4Qx3ZRd3rsSeYggMNqYXG/jSpqZII91trQMKuX PbxkqjnQIyn9fZvy0SxyuCKaYwOmNAB2xVOWI008av+E4xmZZx1TXkJr8KYQo7i+ZONJ vdsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=9AalImK7QUmbbxwIbNhVpUxmHEISnMHi5MHakiQe3ng=; b=gIW81JEOQMJ3GfPGzOq+q0wr6Qv8kM1v614EpnRS3EC7ZKzu23R+lKVpL1hcqVlXMl WgKuEzDc/n2HqXikor+JycowZCPZdPfz/R6XdgJ4cOPpK9GkLqJIs5ZnmW2OdqTeuuFY WDAyWSphYi8DDXojpvrV7styfgG5vRD97+5KLUMR9NgOz/0NWx2hOkaBIfriieekblOt dzfXbDfg7UvT+OllGQiJ7SKXqo1LAGh2M6eGVQK7QedS41ou9pknKetIHU+8kiThcgwX gWDvom1Kj/YsXjhL9D1hifzJCrOnoHop/8G0v61n7RZKLtvPQnx/aT+sixZqN+yAK1a6 dv4Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l67si26884880plb.370.2019.07.29.08.58.54; Mon, 29 Jul 2019 08:59:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387750AbfG2MCd (ORCPT + 99 others); Mon, 29 Jul 2019 08:02:33 -0400 Received: from mx2.suse.de ([195.135.220.15]:48766 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387637AbfG2MCd (ORCPT ); Mon, 29 Jul 2019 08:02:33 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 2914DB61A; Mon, 29 Jul 2019 12:02:31 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 8355B1E3C1F; Mon, 29 Jul 2019 14:02:28 +0200 (CEST) Date: Mon, 29 Jul 2019 14:02:28 +0200 From: Jan Kara To: Dan Williams Cc: Jan Kara , Matthew Wilcox , linux-fsdevel , Boaz Harrosh , stable , Robert Barror , Seema Pandit , linux-nvdimm , Linux Kernel Mailing List Subject: Re: [PATCH] dax: Fix missed PMD wakeups Message-ID: <20190729120228.GC17833@quack2.suse.cz> References: <20190705191004.GC32320@bombadil.infradead.org> <20190710190204.GB14701@quack2.suse.cz> <20190710201539.GN32320@bombadil.infradead.org> <20190710202647.GA7269@quack2.suse.cz> <20190711141350.GS32320@bombadil.infradead.org> <20190711152550.GT32320@bombadil.infradead.org> <20190711154111.GA29284@quack2.suse.cz> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="opJtzjQTFsWo+cga" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --opJtzjQTFsWo+cga Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue 16-07-19 20:39:46, Dan Williams wrote: > On Fri, Jul 12, 2019 at 2:14 AM Jan Kara wrote: > > > > On Thu 11-07-19 08:25:50, Matthew Wilcox wrote: > > > On Thu, Jul 11, 2019 at 07:13:50AM -0700, Matthew Wilcox wrote: > > > > However, the XA_RETRY_ENTRY might be a good choice. It doesn't normally > > > > appear in an XArray (it may appear if you're looking at a deleted node, > > > > but since we're holding the lock, we can't see deleted nodes). > > > > > ... > > > > > @@ -254,7 +267,7 @@ static void wait_entry_unlocked(struct xa_state *xas, void *entry) > > > static void put_unlocked_entry(struct xa_state *xas, void *entry) > > > { > > > /* If we were the only waiter woken, wake the next one */ > > > - if (entry) > > > + if (entry && dax_is_conflict(entry)) > > > > This should be !dax_is_conflict(entry)... > > > > > dax_wake_entry(xas, entry, false); > > > } > > > > Otherwise the patch looks good to me so feel free to add: > > > > Reviewed-by: Jan Kara > > Looks good, and passes the test case. Now pushed out to > libnvdimm-for-next for v5.3 inclusion: > > https://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm.git/commit/?h=libnvdimm-for-next&id=23c84eb7837514e16d79ed6d849b13745e0ce688 Thanks for picking up the patch but you didn't apply the fix I've mentioned above. So put_unlocked_entry() is not waking up anybody anymore... Since this got already to Linus' tree, I guess a separate fixup patch is needed (attached). Honza -- Jan Kara SUSE Labs, CR --opJtzjQTFsWo+cga Content-Type: text/x-patch; charset=us-ascii Content-Disposition: attachment; filename="0001-dax-Fix-missed-wakup-in-put_unlocked_entry.patch" From 950204f7dfdb06198f40820be4d33ce824508f11 Mon Sep 17 00:00:00 2001 From: Jan Kara Date: Mon, 29 Jul 2019 13:57:49 +0200 Subject: [PATCH] dax: Fix missed wakup in put_unlocked_entry() The condition checking whether put_unlocked_entry() needs to wake up following waiter got broken by commit 23c84eb78375 ("dax: Fix missed wakeup with PMD faults"). We need to wake the waiter whenever the passed entry is valid (i.e., non-NULL and not special conflict entry). This could lead to processes never being woken up when waiting for entry lock. Fix the condition. CC: stable@vger.kernel.org Fixes: 23c84eb78375 ("dax: Fix missed wakeup with PMD faults") Signed-off-by: Jan Kara --- fs/dax.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/dax.c b/fs/dax.c index a237141d8787..b64964ef44f6 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -266,7 +266,7 @@ static void wait_entry_unlocked(struct xa_state *xas, void *entry) static void put_unlocked_entry(struct xa_state *xas, void *entry) { /* If we were the only waiter woken, wake the next one */ - if (entry && dax_is_conflict(entry)) + if (entry && !dax_is_conflict(entry)) dax_wake_entry(xas, entry, false); } -- 2.16.4 --opJtzjQTFsWo+cga--