All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] filemap: obey mapping->invalidate_lock lock/unlock order
@ 2022-06-18  8:38 Miaohe Lin
  2022-06-18 10:34 ` Matthew Wilcox
  0 siblings, 1 reply; 7+ messages in thread
From: Miaohe Lin @ 2022-06-18  8:38 UTC (permalink / raw)
  To: akpm, willy; +Cc: linux-fsdevel, linux-mm, linux-kernel, linmiaohe

The invalidate_locks of two mappings should be unlocked in reverse order
relative to the locking order in filemap_invalidate_lock_two(). Modifying
the code to obey it.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 mm/filemap.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/filemap.c b/mm/filemap.c
index 8ef861297ffb..9948b26e6400 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1009,6 +1009,8 @@ EXPORT_SYMBOL(filemap_invalidate_lock_two);
 void filemap_invalidate_unlock_two(struct address_space *mapping1,
 				   struct address_space *mapping2)
 {
+	if (mapping1 < mapping2)
+		swap(mapping1, mapping2);
 	if (mapping1)
 		up_write(&mapping1->invalidate_lock);
 	if (mapping2 && mapping1 != mapping2)
-- 
2.23.0


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

end of thread, other threads:[~2022-06-20 12:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-18  8:38 [PATCH] filemap: obey mapping->invalidate_lock lock/unlock order Miaohe Lin
2022-06-18 10:34 ` Matthew Wilcox
2022-06-20  1:56   ` Miaohe Lin
2022-06-20  4:47     ` Matthew Wilcox
2022-06-20  6:35       ` Miaohe Lin
2022-06-20  9:47         ` Muchun Song
2022-06-20 12:14           ` Miaohe Lin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.