aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xenstore/xenstored_domain.c
diff options
context:
space:
mode:
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-07-24 14:50:05 +0100
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-07-24 14:50:05 +0100
commite573cbf5203769ae6af586712b305b185dd5fdad (patch)
tree166fb8187a381447883a3a5e8fd74d4839945281 /tools/xenstore/xenstored_domain.c
parentab3a30feef59156b71338a449fa71340a1077c86 (diff)
downloadxen-e573cbf5203769ae6af586712b305b185dd5fdad.tar.gz
xen-e573cbf5203769ae6af586712b305b185dd5fdad.tar.bz2
xen-e573cbf5203769ae6af586712b305b185dd5fdad.zip
xenstored: Guarantee to fire @releaseDomain watch when a domain is destructed.
Previously this would be missed on some bail paths within xenstored which would talloc_free() the connection. Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'tools/xenstore/xenstored_domain.c')
-rw-r--r--tools/xenstore/xenstored_domain.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
index 0f6e11a29c..c51e2c73b9 100644
--- a/tools/xenstore/xenstored_domain.c
+++ b/tools/xenstore/xenstored_domain.c
@@ -175,6 +175,8 @@ static int destroy_domain(void *_domain)
if (domain->interface)
munmap(domain->interface, getpagesize());
+ fire_watches(NULL, "@releaseDomain", false);
+
return 0;
}
@@ -197,7 +199,7 @@ static void domain_cleanup(void)
continue;
}
talloc_free(domain->conn);
- notify = 1;
+ notify = 0; /* destroy_domain() fires the watch */
}
if (notify)
@@ -247,7 +249,6 @@ static struct domain *new_domain(void *context, unsigned int domid,
struct domain *domain;
int rc;
-
domain = talloc(context, struct domain);
domain->port = 0;
domain->shutdown = 0;
@@ -361,7 +362,7 @@ void do_introduce(struct connection *conn, struct buffered_data *in)
/* Now domain belongs to its connection. */
talloc_steal(domain->conn, domain);
- fire_watches(conn, "@introduceDomain", false);
+ fire_watches(NULL, "@introduceDomain", false);
} else if ((domain->mfn == mfn) && (domain->conn != conn)) {
/* Use XS_INTRODUCE for recreating the xenbus event-channel. */
if (domain->port)
@@ -414,8 +415,6 @@ void do_release(struct connection *conn, const char *domid_str)
talloc_free(domain->conn);
- fire_watches(conn, "@releaseDomain", false);
-
send_ack(conn, XS_RELEASE);
}