Skip to contentSkip to conversation

fix xenconsoled race

PATCH New John Levon 1 participant 1 message Sep 13, 2006

lore
Share & tools
lore

John Levon

author
#0 lore raw

PATCH 1/1 fix xenconsoled race

# HG changeset patch
# User [email protected]
# Node ID db465ecb164e6d89290ae3d4fcc029e29305ae7d
# Parent c682ae7a17224dc5576ba3c5db47766b2a7dc159
Shouldn't call domain_create_ring() for a domU which is shutting down. There is a race condition between domain_create_ring() and the removal of the do mU entry from xenstore. If the removal of the domU entry from xenstore comes lat er than the first xs_gather() call in domain_create_ring(), it will go on and bi nd the evtchn port to the dying domU, which will cause below error message:
(XEN) (file=event_channel.c, line=144) EVTCHNOP failure: domain 0, error -22, li ne 144

tools/console/daemon/io.c +6 -4
diff -r c682ae7a1722 -r db465ecb164e tools/console/daemon/io.c
@@ -293,12 +293,14 @@ static bool watch_domain(struct domain *
 	bool success;
 
 	sprintf(domid_str, "dom%u", dom->domid);
-	if (watch)
+	if (watch) {
 		success = xs_watch(xs, dom->conspath, domid_str);
-	else
+		if (success)
+			domain_create_ring(dom);
+	} else {
 		success = xs_unwatch(xs, dom->conspath, domid_str);
-	if (success)
-		domain_create_ring(dom);
+	}
+
 	return success;
 }