[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Detect failure to create shutdown process and retry twice
# HG changeset patch # User kaf24@xxxxxxxxxxxxxxxxxxxx # Node ID 938f209d886be754eaeff4683b021bb4647078a1 # Parent 4c9dbbb5fe3dae45a3016acc65b032e606dca270 Detect failure to create shutdown process and retry twice per second until it succeeds. Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> diff -r 4c9dbbb5fe3d -r 938f209d886b linux-2.6-xen-sparse/arch/xen/kernel/reboot.c --- a/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c Sat Oct 15 11:56:07 2005 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c Sat Oct 15 15:25:05 2005 @@ -26,7 +26,6 @@ // the distinction when we return the reason code to them. #define SHUTDOWN_HALT 4 - void machine_restart(char * __unused) { /* We really want to get pending console data out before we die. */ @@ -60,6 +59,8 @@ /* Ignore multiple shutdown requests. */ static int shutting_down = SHUTDOWN_INVALID; +static void __shutdown_handler(void *unused); +static DECLARE_WORK(shutdown_work, __shutdown_handler, NULL); #ifndef CONFIG_HOTPLUG_CPU #define cpu_down(x) (-EOPNOTSUPP) @@ -243,40 +244,46 @@ return 0; } -static struct task_struct *kthread_create_on_cpu(int (*f)(void *arg), - void *arg, - const char *name, - int cpu) +static int kthread_create_on_cpu(int (*f)(void *arg), + void *arg, + const char *name, + int cpu) { struct task_struct *p; p = kthread_create(f, arg, name); + if (IS_ERR(p)) + return PTR_ERR(p); kthread_bind(p, cpu); wake_up_process(p); - return p; + return 0; } static void __shutdown_handler(void *unused) { int err; - if (shutting_down != SHUTDOWN_SUSPEND) { + if (shutting_down != SHUTDOWN_SUSPEND) err = kernel_thread(shutdown_process, NULL, CLONE_FS | CLONE_FILES); - if ( err < 0 ) - printk(KERN_ALERT "Error creating shutdown " - "process!\n"); - } else { - kthread_create_on_cpu(__do_suspend, NULL, "suspender", 0); + else + err = kthread_create_on_cpu(__do_suspend, NULL, "suspend", 0); + + if ( err < 0 ) { + printk(KERN_WARNING "Error creating shutdown process (%d): " + "retrying...\n", -err); + schedule_delayed_work(&shutdown_work, HZ/2); } } static void shutdown_handler(struct xenbus_watch *watch, const char **vec, unsigned int len) { - static DECLARE_WORK(shutdown_work, __shutdown_handler, NULL); char *str; struct xenbus_transaction *xbt; int err; + + if (shutting_down != SHUTDOWN_INVALID) + goto out; again: xbt = xenbus_transaction_start(); @@ -312,6 +319,7 @@ kfree(str); + out: if (shutting_down != SHUTDOWN_INVALID) schedule_work(&shutdown_work); } _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |