WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Detect failure to create shutdown process and retry twic

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Detect failure to create shutdown process and retry twice
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Sun, 16 Oct 2005 12:16:11 +0000
Delivery-date: Sun, 16 Oct 2005 12:13:43 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Detect failure to create shutdown process and retry twice, Xen patchbot -unstable <=