Commit ca61a009 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] additional might_sleep checks

- Dave says that lock_sock() inside locks is a popular bug.  Put a
  check there.

- Also in wait_for_completion().

- Add the text "Debug" to the warning message so people are less
  likely to think that they've oopsed.
parent e4c0058e
......@@ -309,7 +309,8 @@ static __inline__ void sock_prot_dec_use(struct proto *prot)
extern void __lock_sock(struct sock *sk);
extern void __release_sock(struct sock *sk);
#define lock_sock(__sk) \
do { spin_lock_bh(&((__sk)->lock.slock)); \
do { might_sleep(); \
spin_lock_bh(&((__sk)->lock.slock)); \
if ((__sk)->lock.users != 0) \
__lock_sock(__sk); \
(__sk)->lock.users = 1; \
......
......@@ -1163,6 +1163,7 @@ void complete(struct completion *x)
void wait_for_completion(struct completion *x)
{
might_sleep();
spin_lock_irq(&x->wait.lock);
if (!x->done) {
DECLARE_WAITQUEUE(wait, current);
......@@ -2158,7 +2159,7 @@ void __might_sleep(char *file, int line)
if (time_before(jiffies, prev_jiffy + HZ))
return;
prev_jiffy = jiffies;
printk("Sleeping function called from illegal"
printk(KERN_ERR "Debug: sleeping function called from illegal"
" context at %s:%d\n", file, line);
dump_stack();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment