Skip to contentSkip to conversation

Don't unbind port when event channel binding fails! This happens when xend tries to introduce the same domain twice, giving strange effects when xend restarts.

PATCH New Rusty Russell 1 participant 1 message Aug 4, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 7/11 Don't unbind port when event channel binding fails! This happens when xend tries to introduce the same domain twice, giving strange effects when xend restarts.

# HG changeset patch
# User Rusty Russell <[email protected]>
# Node ID 3550a20343ba6762cfca9e43d38866b036363e32
# Parent b0de1894df67ac7c7d905bf61cdf0210b42752cc
Don't unbind port when event channel binding fails! This happens when xend tries to introduce the same domain twice, giving strange effects when xend restarts.

tools/xenstore/xenstored_domain.c +3 -2
diff -r b0de1894df67 -r 3550a20343ba tools/xenstore/xenstored_domain.c
@@ -261,8 +261,8 @@
 {
 	struct domain *domain;
 	domain = talloc(context, struct domain);
+	domain->port = 0;
 	domain->domid = domid;
-	domain->port = port;
 	domain->path = talloc_strdup(domain, path);
 	domain->page = xc_map_foreign_range(*xc_handle, domain->domid,
 					    getpagesize(),
@@ -279,9 +279,10 @@
 	domain->output = domain->page + getpagesize()/2;
 
 	/* Tell kernel we're interested in this event. */
-	if (ioctl(eventchn_fd, EVENTCHN_BIND, domain->port) != 0)
+	if (ioctl(eventchn_fd, EVENTCHN_BIND, port) != 0)
 		return NULL;
 
+	domain->port = port;
 	domain->conn = new_connection(writechn, readchn);
 	domain->conn->domain = domain;
 	return domain;