Commit e7a121e3 authored by Matthew Wilcox's avatar Matthew Wilcox Committed by Greg Kroah-Hartman

dax: Avoid losing wakeup in dax_lock_mapping_entry

commit 25bbe21b upstream.

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

Fixes: c2a7d2a1 ("filesystem-dax: Introduce dax_lock_mapping_entry()")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarMatthew Wilcox <willy@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9dec3855
...@@ -217,6 +217,9 @@ static inline void *unlock_slot(struct address_space *mapping, void **slot) ...@@ -217,6 +217,9 @@ static inline void *unlock_slot(struct address_space *mapping, void **slot)
return (void *)entry; 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 * Lookup entry in radix tree, wait for it to become unlocked if it is
* exceptional entry and return it. The caller must call * exceptional entry and return it. The caller must call
...@@ -256,8 +259,10 @@ static void *__get_unlocked_mapping_entry(struct address_space *mapping, ...@@ -256,8 +259,10 @@ static void *__get_unlocked_mapping_entry(struct address_space *mapping,
revalidate = wait_fn(); revalidate = wait_fn();
finish_wait(wq, &ewait.wait); finish_wait(wq, &ewait.wait);
xa_lock_irq(&mapping->i_pages); xa_lock_irq(&mapping->i_pages);
if (revalidate) if (revalidate) {
put_unlocked_mapping_entry(mapping, index, entry);
return ERR_PTR(-EAGAIN); return ERR_PTR(-EAGAIN);
}
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment