From: Miaohe Lin <linmiaohe@huawei.com>
To: <akpm@linux-foundation.org>, <willy@infradead.org>
Cc: <linux-fsdevel@vger.kernel.org>, <linux-mm@kvack.org>,
<linux-kernel@vger.kernel.org>, <linmiaohe@huawei.com>
Subject: [PATCH] filemap: obey mapping->invalidate_lock lock/unlock order
Date: Sat, 18 Jun 2022 16:38:20 +0800 [thread overview]
Message-ID: <20220618083820.35626-1-linmiaohe@huawei.com> (raw)
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
next reply other threads:[~2022-06-18 8:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-18 8:38 Miaohe Lin [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220618083820.35626-1-linmiaohe@huawei.com \
--to=linmiaohe@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox