linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [4.19-stable PATCH] dax: Avoid losing wakeup in dax_lock_mapping_entry
       [not found] <20181126142743.GA25618@bombadil.infradead.org>
@ 2018-11-28 18:53 ` Dan Williams
  2018-11-29  8:04   ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Williams @ 2018-11-28 18:53 UTC (permalink / raw)
  To: stable; +Cc: Matthew Wilcox, linux-nvdimm, linux-kernel, linux-fsdevel

From: Matthew Wilcox <willy@infradead.org>

commit 25bbe21bf427a81b8e3ccd480ea0e1d940256156 upstream.

After calling get_unlocked_entry(), you have to call
put_unlocked_entry() to avoid subsequent waiters losing wakeups.

Fixes: c2a7d2a11552 ("filesystem-dax: Introduce dax_lock_mapping_entry()")
Cc: <stable@vger.kernel.org>
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
Passes the nvdimm unit test suite which exercises the lock path.

 fs/dax.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/dax.c b/fs/dax.c
index 0fb270f0a0ef..b0cd1364c68f 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -217,6 +217,9 @@ static inline void *unlock_slot(struct address_space *mapping, void **slot)
 	return (void *)entry;
 }
 
+static void put_unlocked_mapping_entry(struct address_space *mapping,
+				       pgoff_t index, void *entry);
+
 /*
  * Lookup entry in radix tree, wait for it to become unlocked if it is
  * exceptional entry and return it. The caller must call
@@ -256,8 +259,10 @@ static void *__get_unlocked_mapping_entry(struct address_space *mapping,
 		revalidate = wait_fn();
 		finish_wait(wq, &ewait.wait);
 		xa_lock_irq(&mapping->i_pages);
-		if (revalidate)
+		if (revalidate) {
+			put_unlocked_mapping_entry(mapping, index, entry);
 			return ERR_PTR(-EAGAIN);
+		}
 	}
 }
 


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [4.19-stable PATCH] dax: Avoid losing wakeup in dax_lock_mapping_entry
  2018-11-28 18:53 ` [4.19-stable PATCH] dax: Avoid losing wakeup in dax_lock_mapping_entry Dan Williams
@ 2018-11-29  8:04   ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2018-11-29  8:04 UTC (permalink / raw)
  To: Dan Williams
  Cc: stable, Matthew Wilcox, linux-nvdimm, linux-kernel, linux-fsdevel

On Wed, Nov 28, 2018 at 10:53:44AM -0800, Dan Williams wrote:
> From: Matthew Wilcox <willy@infradead.org>
> 
> commit 25bbe21bf427a81b8e3ccd480ea0e1d940256156 upstream.
> 
> After calling get_unlocked_entry(), you have to call
> put_unlocked_entry() to avoid subsequent waiters losing wakeups.
> 
> Fixes: c2a7d2a11552 ("filesystem-dax: Introduce dax_lock_mapping_entry()")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Matthew Wilcox <willy@infradead.org>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
> Passes the nvdimm unit test suite which exercises the lock path.

Now applied, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-11-29  8:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20181126142743.GA25618@bombadil.infradead.org>
2018-11-28 18:53 ` [4.19-stable PATCH] dax: Avoid losing wakeup in dax_lock_mapping_entry Dan Williams
2018-11-29  8:04   ` Greg KH

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).