diff options
author | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2007-03-01 14:51:12 +0000 |
---|---|---|
committer | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2007-03-01 14:51:12 +0000 |
commit | 5d8d99be048899c0438dab4e726238eb97b0440f (patch) | |
tree | 47f33af3a57368d29ee163411943b600c933cf67 /tools/xenstore/xenstored_domain.c | |
parent | 4bbfa3da11b9d28cb3e17a49193ac2c60fbae09b (diff) | |
download | xen-5d8d99be048899c0438dab4e726238eb97b0440f.tar.gz xen-5d8d99be048899c0438dab4e726238eb97b0440f.tar.bz2 xen-5d8d99be048899c0438dab4e726238eb97b0440f.zip |
Fully reset the xenstore connection when a domain is (re)introduced to xenstored.
Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'tools/xenstore/xenstored_domain.c')
-rw-r--r-- | tools/xenstore/xenstored_domain.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c index ba3507fdfc..5249ef6d56 100644 --- a/tools/xenstore/xenstored_domain.c +++ b/tools/xenstore/xenstored_domain.c @@ -28,6 +28,7 @@ #include "talloc.h" #include "xenstored_core.h" #include "xenstored_domain.h" +#include "xenstored_transaction.h" #include "xenstored_watch.h" #include "xenstored_test.h" @@ -289,6 +290,26 @@ static struct domain *find_domain_by_domid(unsigned int domid) return NULL; } +static void domain_conn_reset(struct domain *domain) +{ + struct connection *conn = domain->conn; + struct buffered_data *out; + + conn_delete_all_watches(conn); + conn_delete_all_transactions(conn); + + while ((out = list_top(&conn->out_list, struct buffered_data, list))) { + list_del(&out->list); + talloc_free(out); + } + + talloc_free(conn->in->buffer); + memset(conn->in, 0, sizeof(*conn->in)); + conn->in->inhdr = true; + + domain->interface->req_cons = domain->interface->req_prod = 0; + domain->interface->rsp_cons = domain->interface->rsp_prod = 0; +} /* domid, mfn, evtchn, path */ void do_introduce(struct connection *conn, struct buffered_data *in) @@ -342,7 +363,7 @@ void do_introduce(struct connection *conn, struct buffered_data *in) talloc_steal(domain->conn, domain); fire_watches(conn, "@introduceDomain", false); - } else if (domain->mfn == mfn) { + } else if ((domain->mfn == mfn) && (domain->conn != conn)) { /* Use XS_INTRODUCE for recreating the xenbus event-channel. */ if (domain->port) xc_evtchn_unbind(xce_handle, domain->port); @@ -354,9 +375,7 @@ void do_introduce(struct connection *conn, struct buffered_data *in) return; } - /* Rings must be quiesced. */ - domain->interface->req_cons = domain->interface->req_prod = 0; - domain->interface->rsp_cons = domain->interface->rsp_prod = 0; + domain_conn_reset(domain); send_ack(conn, XS_INTRODUCE); } |