summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Morton <akpm@digeo.com>2002-09-29 02:19:51 -0700
committerLinus Torvalds <torvalds@home.transmeta.com>2002-09-29 02:19:51 -0700
commitca61a009a128ed6c0aaa00f9bd444deb54db1eaa (patch)
tree311bd662673cb3f3fc3516f77a12ed79c2b3c3dd
parente4c0058e8a53b176408bcb879a90fd431336319d (diff)
[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.
-rw-r--r--include/net/sock.h3
-rw-r--r--kernel/sched.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index da47601e4290..51ce0de50c43 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -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; \
diff --git a/kernel/sched.c b/kernel/sched.c
index 44d4929ca677..aa13d6a55721 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -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();
}