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

From: Matthew Wilcox (Oracle)
Date: Thu Sep 07 2023 - 13:48:00 EST


This slightly strengthens our checks when lockdep is disabled.

Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
---
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