From: kaf24@localhost.localdomain Date: Sat, 19 Aug 2006 09:21:02 +0000 (+0100) Subject: [XENBUS] Cleanup correctly on suspend, unregister watches. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15710^2~35 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=a2a686df0067f2f7e21a56a9347fe88b51700e76;p=xen.git [XENBUS] Cleanup correctly on suspend, unregister watches. Again needed for domU kexec, so the next kernel instance can register watches without running into -EBUSY. Signed-off-by: Gerd Hoffmann --- diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c index d7f6793d48..190fa1e794 100644 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c @@ -665,7 +665,17 @@ EXPORT_SYMBOL_GPL(unregister_xenbus_watch); void xs_suspend(void) { + struct xenbus_watch *watch; + char token[sizeof(watch) * 2 + 1]; + down_write(&xs_state.suspend_mutex); + + /* No need for watches_lock: the suspend_mutex is sufficient. */ + list_for_each_entry(watch, &watches, list) { + sprintf(token, "%lX", (long)watch); + xs_unwatch(watch->node, token); + } + mutex_lock(&xs_state.request_mutex); }