ia64/xen-unstable

changeset 6820:36c4d3bb29c8

Don't cause watch fire deadlock by unconditionally rewriting the sysrq node.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Tue Sep 13 21:24:03 2005 +0000 (2005-09-13)
parents 3eea03342466
children 1ad652222dba
files linux-2.6-xen-sparse/arch/xen/kernel/reboot.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c	Tue Sep 13 21:00:13 2005 +0000
     1.2 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c	Tue Sep 13 21:24:03 2005 +0000
     1.3 @@ -355,16 +355,26 @@ static void shutdown_handler(struct xenb
     1.4  static void sysrq_handler(struct xenbus_watch *watch, const char *node)
     1.5  {
     1.6      char sysrq_key = '\0';
     1.7 -    
     1.8 +    int err;
     1.9 +
    1.10 + again:
    1.11 +    err = xenbus_transaction_start("control");
    1.12 +    if (err)
    1.13 +	return;
    1.14      if (!xenbus_scanf("control", "sysrq", "%c", &sysrq_key)) {
    1.15          printk(KERN_ERR "Unable to read sysrq code in control/sysrq\n");
    1.16 -        return;
    1.17 +	xenbus_transaction_end(1);
    1.18 +	return;
    1.19      }
    1.20  
    1.21 -    xenbus_printf("control", "sysrq", "%c", '\0');
    1.22 +    if (sysrq_key != '\0')
    1.23 +	xenbus_printf("control", "sysrq", "%c", '\0');
    1.24 +
    1.25 +    err = xenbus_transaction_end(0);
    1.26 +    if (err == -ETIMEDOUT)
    1.27 +	goto again;
    1.28  
    1.29      if (sysrq_key != '\0') {
    1.30 -
    1.31  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
    1.32          handle_sysrq(sysrq_key, NULL, NULL);
    1.33  #else