aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/xen/xenbus/xenbus_xs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/xen/xenbus/xenbus_xs.c')
-rw-r--r--drivers/xen/xenbus/xenbus_xs.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c
index 5534690075af..b3b8f2f3ad10 100644
--- a/drivers/xen/xenbus/xenbus_xs.c
+++ b/drivers/xen/xenbus/xenbus_xs.c
@@ -45,6 +45,7 @@
45#include <linux/module.h> 45#include <linux/module.h>
46#include <linux/mutex.h> 46#include <linux/mutex.h>
47#include <xen/xenbus.h> 47#include <xen/xenbus.h>
48#include <xen/xen.h>
48#include "xenbus_comms.h" 49#include "xenbus_comms.h"
49 50
50struct xs_stored_msg { 51struct xs_stored_msg {
@@ -620,6 +621,15 @@ static struct xenbus_watch *find_watch(const char *token)
620 return NULL; 621 return NULL;
621} 622}
622 623
624static void xs_reset_watches(void)
625{
626 int err;
627
628 err = xs_error(xs_single(XBT_NIL, XS_RESET_WATCHES, "", NULL));
629 if (err && err != -EEXIST)
630 printk(KERN_WARNING "xs_reset_watches failed: %d\n", err);
631}
632
623/* Register callback to watch this node. */ 633/* Register callback to watch this node. */
624int register_xenbus_watch(struct xenbus_watch *watch) 634int register_xenbus_watch(struct xenbus_watch *watch)
625{ 635{
@@ -638,8 +648,7 @@ int register_xenbus_watch(struct xenbus_watch *watch)
638 648
639 err = xs_watch(watch->node, token); 649 err = xs_watch(watch->node, token);
640 650
641 /* Ignore errors due to multiple registration. */ 651 if (err) {
642 if ((err != 0) && (err != -EEXIST)) {
643 spin_lock(&watches_lock); 652 spin_lock(&watches_lock);
644 list_del(&watch->list); 653 list_del(&watch->list);
645 spin_unlock(&watches_lock); 654 spin_unlock(&watches_lock);
@@ -897,5 +906,9 @@ int xs_init(void)
897 if (IS_ERR(task)) 906 if (IS_ERR(task))
898 return PTR_ERR(task); 907 return PTR_ERR(task);
899 908
909 /* shutdown watches for kexec boot */
910 if (xen_hvm_domain())
911 xs_reset_watches();
912
900 return 0; 913 return 0;
901} 914}