[patch] syslog fix? 2.2.2

Ingo Molnar (mingo@chiara.csoma.elte.hu)
Mon, 1 Mar 1999 22:02:44 +0100 (CET)


this one looks like a place that relies on the 'old' behavior of
sleep_on*? We go into interruptible_sleep_on() with interrupts disabled,
and if sleep_on() write-locks on waitqueue_lock, another CPU read-locks
waitqueue_lock and is interrupted, then that IRQ or bh deadlocks, boom.

this might explain the hang Christoph is seeing.

this also means that it's completely illegal to do sleep_on* with
interrupts disabled ... have i missed something?

-- mingo

--- linux/kernel/printk.c.orig Mon Mar 1 10:18:56 1999
+++ linux/kernel/printk.c Mon Mar 1 10:23:30 1999
@@ -137,14 +137,22 @@
error = verify_area(VERIFY_WRITE,buf,len);
if (error)
goto out;
+ /*
+ * the 'cleaner' way would be to use console_lock. The
+ * reason why we dont do this is that we want to have
+ * a working printk() even if we crash in the middle
+ * of do_syslog()... Thus the ugly cli()'s. Otherwise,
+ * syslog() is not very performance-critical anyway.
+ */
cli();
error = -ERESTARTSYS;
while (!log_size) {
+ sti();
if (signal_pending(current)) {
- sti();
goto out;
}
interruptible_sleep_on(&log_wait);
+ cli();
}
i = 0;
while (log_size && i < len) {

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/