Andrew Morton wrote: > On Tue, 9 Sep 2008 11:55:36 +0100 Alan Cox wrote: >> lock_kernel can sleep. > > That used to be the case, but the mutex_lock() version of the bkl got > removed. It may of course come back. > >> Its not allowed... >> > > yup. OK, attached is a new version of this patch: tty-fix-echo-tab-erase-and-locking.patch I have removed lock_kernel() from n_tty.c completely (which is a nice benefit). As we discussed, this is now easier due to my echo patch isolating the column state code. In its place, I created two new mutex locks: "output_lock" (protects column state and and driver buffer space left) and "echo_lock" (protects the echo buffer). I could have used just one to protect all of this, but there was no need to make the lock that wide-ranging (e.g., it's OK to add stuff to the echo buffer while regular output is happening). All echo buffer operations take the echo lock, and all process_out* functions take output lock. The one function that takes both locks is process_echoes (this is the one that erroneously took both the echo spin lock and the BKL before). Note that the process_output functions are at least sometimes (and maybe all of the time) locked by tty_write_lock (as Alan mentioned), but this does not protect echo from interfering with regular output. Let me know what you think of this patch. I am using it now, and it appears to work well so far. Thanks again, Joe