[PATCH 2/5] mm: Use rwsem_is_write_locked in mmap_assert_write_locked

Matthew Wilcox (Oracle)
2023-09-07T17:47:59Z

This slightly strengthens our checks when lockdep is disabled.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
include/linux/mmap_lock.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/mmap_lock.h b/include/linux/mmap_lock.h
index 8d38dcb6d044..0258b06668e8 100644
--- a/include/linux/mmap_lock.h
+++ b/include/linux/mmap_lock.h
@@ -69,7 +69,7 @@ static inline void mmap_assert_locked(struct mm_struct *mm)
static inline void mmap_assert_write_locked(struct mm_struct *mm)
{
lockdep_assert_held_write(&mm->mmap_lock);
- VM_BUG_ON_MM(!rwsem_is_locked(&mm->mmap_lock), mm);
+ VM_BUG_ON_MM(!rwsem_is_write_locked(&mm->mmap_lock), mm);
}

#ifdef CONFIG_PER_VMA_LOCK
--
2.40.1