[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220618083820.35626-1-linmiaohe@huawei.com>
Date: Sat, 18 Jun 2022 16:38:20 +0800
From: Miaohe Lin <linmiaohe@...wei.com>
To: <akpm@...ux-foundation.org>, <willy@...radead.org>
CC: <linux-fsdevel@...r.kernel.org>, <linux-mm@...ck.org>,
<linux-kernel@...r.kernel.org>, <linmiaohe@...wei.com>
Subject: [PATCH] filemap: obey mapping->invalidate_lock lock/unlock order
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@...wei.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
Powered by blists - more mailing lists