From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olaf Hering Subject: [PATCH 06/11] xen/hvm kexec: unregister shutdown+sysrq watches during reboot Date: Thu, 28 Jul 2011 15:23:06 +0200 Message-ID: <20110728132302.126984180@aepfle.de> References: <20110728132300.248098023@aepfle.de> Return-path: Content-Disposition: inline; filename=xen.syscore_ops.unregister_watch.shutdown_event.patch List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Unregister the shutdown and sysrq watch during kexec. The watches can not be re-registered in the kexec kernel because they are still seen as busy by xenstore. v2: use kexec_is_loaded() function Signed-off-by: Olaf Hering --- drivers/xen/manage.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) Index: linux-3.0/drivers/xen/manage.c =================================================================== --- linux-3.0.orig/drivers/xen/manage.c +++ linux-3.0/drivers/xen/manage.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -320,6 +321,21 @@ static int shutdown_event(struct notifie return NOTIFY_DONE; } +static void xenbus_manage_shutdown_watcher(void) +{ + if (!kexec_is_loaded()) + return; + + unregister_xenbus_watch(&shutdown_watch); +#ifdef CONFIG_MAGIC_SYSRQ + unregister_xenbus_watch(&sysrq_watch); +#endif +} + +static struct syscore_ops xenbus_manage_watcher_syscore_ops = { + .shutdown = xenbus_manage_shutdown_watcher, +}; + int xen_setup_shutdown_event(void) { static struct notifier_block xenstore_notifier = { @@ -329,6 +345,7 @@ int xen_setup_shutdown_event(void) if (!xen_domain()) return -ENODEV; register_xenstore_notifier(&xenstore_notifier); + register_syscore_ops(&xenbus_manage_watcher_syscore_ops); return 0; }