From 8b6312f4dcc1efe7975731b6c47dd134282bd9ac Mon Sep 17 00:00:00 2001 From: "Eric W. Biederman" Date: Sat, 10 Feb 2007 01:44:34 -0800 Subject: [PATCH] vt: refactor console SAK processing This does several things. - It moves looking up of the current foreground console into process context where we can safely take the semaphore that protects this operation. - It uses the new flavor of work queue processing. - This generates a factor of do_SAK, __do_SAK that runs immediately. - This calls __do_SAK with the console semaphore held ensuring nothing else happens to the console while we process the SAK operation. - With the console SAK processing moved into process context this patch removes the xchg operations that I used to attempt to attomically update struct pid, because of the strange locking used in the SAK processing. With SAK using the normal console semaphore nothing special is needed. Cc: Oleg Nesterov Signed-off-by: Eric W. Biederman Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/char/sysrq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/char/sysrq.c') diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c index 7fd3cd5ddf2..3757610b783 100644 --- a/drivers/char/sysrq.c +++ b/drivers/char/sysrq.c @@ -88,9 +88,9 @@ static struct sysrq_key_op sysrq_loglevel_op = { #ifdef CONFIG_VT static void sysrq_handle_SAK(int key, struct tty_struct *tty) { - if (tty) - do_SAK(tty); - reset_vc(vc_cons[fg_console].d); + struct work_struct *SAK_work = &vc_cons[fg_console].SAK_work; + PREPARE_WORK(SAK_work, vc_SAK); + schedule_work(SAK_work); } static struct sysrq_key_op sysrq_SAK_op = { .handler = sysrq_handle_SAK, -- cgit v1.2.3