[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] xenstored: allow guest to shutdown all its watches/transactions



# HG changeset patch
# User Olaf Hering <olaf@xxxxxxxxx>
# Date 1316081285 -3600
# Node ID 42a45baf037dfc0d0ad09c29b0f6149304023802
# Parent  e90438f6e6d1585a71b18784a99c162b5d95f390
xenstored: allow guest to shutdown all its watches/transactions

During kexec all old watches have to be removed, otherwise the new
kernel will receive unexpected events. Allow a guest to reset itself
and cleanup all of its watches and transactions.

Add a new XS_RESET_WATCHES command to do the reset on behalf of the
guest.

(Changes by iwj: specify the argument to be a single nul byte.  Permit
read-only clients to use the new command.)

Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---


diff -r e90438f6e6d1 -r 42a45baf037d docs/misc/xenstore.txt
--- a/docs/misc/xenstore.txt    Wed Sep 14 11:38:13 2011 +0100
+++ b/docs/misc/xenstore.txt    Thu Sep 15 11:08:05 2011 +0100
@@ -217,6 +217,9 @@
 
 UNWATCH                        <wpath>|<token>|?
 
+RESET_WATCHES          |
+       Reset all watches and transactions of the caller.
+
 ---------- Transactions ----------
 
 TRANSACTION_START      |                       <transid>|
diff -r e90438f6e6d1 -r 42a45baf037d tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c   Wed Sep 14 11:38:13 2011 +0100
+++ b/tools/xenstore/xenstored_core.c   Thu Sep 15 11:08:05 2011 +0100
@@ -120,6 +120,7 @@
        case XS_IS_DOMAIN_INTRODUCED: return "XS_IS_DOMAIN_INTRODUCED";
        case XS_RESUME: return "RESUME";
        case XS_SET_TARGET: return "SET_TARGET";
+       case XS_RESET_WATCHES: return "RESET_WATCHES";
        default:
                return "**UNKNOWN**";
        }
@@ -1242,6 +1243,10 @@
                do_set_target(conn, in);
                break;
 
+       case XS_RESET_WATCHES:
+               do_reset_watches(conn);
+               break;
+
        default:
                eprintf("Client unknown operation %i", in->hdr.msg.type);
                send_error(conn, ENOSYS);
diff -r e90438f6e6d1 -r 42a45baf037d tools/xenstore/xenstored_domain.c
--- a/tools/xenstore/xenstored_domain.c Wed Sep 14 11:38:13 2011 +0100
+++ b/tools/xenstore/xenstored_domain.c Thu Sep 15 11:08:05 2011 +0100
@@ -537,6 +537,15 @@
        send_reply(conn, XS_IS_DOMAIN_INTRODUCED, result ? "T" : "F", 2);
 }
 
+/* Allow guest to reset all watches */
+void do_reset_watches(struct connection *conn)
+{
+       conn_delete_all_watches(conn);
+       conn_delete_all_transactions(conn);
+
+       send_ack(conn, XS_RESET_WATCHES);
+}
+
 static int close_xc_handle(void *_handle)
 {
        xc_interface_close(*(xc_interface**)_handle);
diff -r e90438f6e6d1 -r 42a45baf037d tools/xenstore/xenstored_domain.h
--- a/tools/xenstore/xenstored_domain.h Wed Sep 14 11:38:13 2011 +0100
+++ b/tools/xenstore/xenstored_domain.h Thu Sep 15 11:08:05 2011 +0100
@@ -40,6 +40,9 @@
 /* domid */
 void do_get_domain_path(struct connection *conn, const char *domid_str);
 
+/* Allow guest to reset all watches */
+void do_reset_watches(struct connection *conn);
+
 void domain_init(void);
 
 /* Returns the implicit path of a connection (only domains have this) */
diff -r e90438f6e6d1 -r 42a45baf037d xen/include/public/io/xs_wire.h
--- a/xen/include/public/io/xs_wire.h   Wed Sep 14 11:38:13 2011 +0100
+++ b/xen/include/public/io/xs_wire.h   Thu Sep 15 11:08:05 2011 +0100
@@ -48,7 +48,8 @@
     XS_IS_DOMAIN_INTRODUCED,
     XS_RESUME,
     XS_SET_TARGET,
-    XS_RESTRICT
+    XS_RESTRICT,
+    XS_RESET_WATCHES
 };
 
 #define XS_WRITE_NONE "NONE"

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.