srcu: Add might_sleep() annotation to synchronize_srcu()
authorLai Jiangshan <laijs@cn.fujitsu.com>
Thu, 29 Nov 2012 08:46:03 +0000 (16:46 +0800)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Thu, 7 Feb 2013 23:08:19 +0000 (15:08 -0800)
Although synchronize_srcu() can sleep, it will not sleep if the fast
path succeeds, which means that illegal use of synchronize_rcu()
might go unnoticed.  This commit therefore adds might_sleep(), which
unconditionally catches illegal use of synchronize_rcu() from atomic
context.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
kernel/srcu.c

index c9d003bc6c49269c098c66771f237a116d1b2c7b..3e43a214b4dce6d22744f3604d30a2ba229d323e 100644 (file)
@@ -421,6 +421,7 @@ static void __synchronize_srcu(struct srcu_struct *sp, int trycount)
                           !lock_is_held(&rcu_sched_lock_map),
                           "Illegal synchronize_srcu() in same-type SRCU (or RCU) read-side critical section");
 
+       might_sleep();
        init_completion(&rcu.completion);
 
        head->next = NULL;