futex: Replace spin_is_locked() with lockdep

lockdep_assert_held() is better suited for checking locking requirements,
since it won't get confused when the lock is held by some other task. This
is also a step towards possibly removing spin_is_locked().

Signed-off-by: Lance Roy <ldr709@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: "Paul E. McKenney" <paulmck@linux.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Darren Hart <dvhart@infradead.org>
Link: https://lkml.kernel.org/r/20181003053902.6910-12-ldr709@gmail.com
This commit is contained in:
Lance Roy 2018-10-02 22:38:57 -07:00 committed by Thomas Gleixner
parent 8ca2b56cd7
commit 4de1a293a0
1 changed files with 2 additions and 2 deletions

View File

@ -1365,9 +1365,9 @@ static void __unqueue_futex(struct futex_q *q)
{ {
struct futex_hash_bucket *hb; struct futex_hash_bucket *hb;
if (WARN_ON_SMP(!q->lock_ptr || !spin_is_locked(q->lock_ptr)) if (WARN_ON_SMP(!q->lock_ptr) || WARN_ON(plist_node_empty(&q->list)))
|| WARN_ON(plist_node_empty(&q->list)))
return; return;
lockdep_assert_held(q->lock_ptr);
hb = container_of(q->lock_ptr, struct futex_hash_bucket, lock); hb = container_of(q->lock_ptr, struct futex_hash_bucket, lock);
plist_del(&q->list, &hb->chain); plist_del(&q->list, &hb->chain);