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@xxxxxxxxxx> --- 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