sched/wait: assert the wait_queue_head lock is held in __wake_up_common
authorChristoph Hellwig <[email protected]>
Wed, 22 Aug 2018 04:56:34 +0000 (21:56 -0700)
committerLinus Torvalds <[email protected]>
Wed, 22 Aug 2018 17:52:47 +0000 (10:52 -0700)
Better ensure we actually hold the lock using lockdep than just commenting
on it.  Due to the various exported _locked interfaces it is far too easy
to get the locking wrong.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Christoph Hellwig <[email protected]>
Acked-by: Ingo Molnar <[email protected]>
Cc: Al Viro <[email protected]>
Cc: Andrea Arcangeli <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Jason Baron <[email protected]>
Cc: Matthew Wilcox <[email protected]>
Cc: Mike Rapoport <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Davidlohr Bueso <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
kernel/sched/wait.c

index 870f97b313e3891003b30982603cf333a879d4a8..5dd47f1103d18bd769cace68b753088574e02f27 100644 (file)
@@ -69,6 +69,8 @@ static int __wake_up_common(struct wait_queue_head *wq_head, unsigned int mode,
        wait_queue_entry_t *curr, *next;
        int cnt = 0;
 
+       lockdep_assert_held(&wq_head->lock);
+
        if (bookmark && (bookmark->flags & WQ_FLAG_BOOKMARK)) {
                curr = list_next_entry(bookmark, entry);