ia64/xen-unstable

changeset 19561:69ba67bdbf93

xenconsoled: Fixes to domain management.

Event-channel setup: Re-bind if the connection becomes unbound (e.g.,
due to 'slow' domain suspend cancellation), even if the remote port
identifier has not changed.

Domain logging: Only open log file once (don't leak fds) and fix a
small memory leak.

Evtchn changes based on a patch by Jiri Denemark <jdenemar@redhat.com>

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Apr 20 15:38:29 2009 +0100 (2009-04-20)
parents 423a7f500059
children 5599cc1e0a84
files tools/console/daemon/io.c
line diff
     1.1 --- a/tools/console/daemon/io.c	Mon Apr 20 14:56:31 2009 +0100
     1.2 +++ b/tools/console/daemon/io.c	Mon Apr 20 15:38:29 2009 +0100
     1.3 @@ -288,6 +288,7 @@ static int create_domain_log(struct doma
     1.4  	namepath = s;
     1.5  	strcat(namepath, "/name");
     1.6  	data = xs_read(xs, XBT_NULL, namepath, &len);
     1.7 +	free(namepath);
     1.8  	if (!data)
     1.9  		return -1;
    1.10  	if (!len) {
    1.11 @@ -548,9 +549,6 @@ static int domain_create_ring(struct dom
    1.12  	}
    1.13  	free(type);
    1.14  
    1.15 -	if ((ring_ref == dom->ring_ref) && (remote_port == dom->remote_port))
    1.16 -		goto out;
    1.17 -
    1.18  	if (ring_ref != dom->ring_ref) {
    1.19  		if (dom->interface != NULL)
    1.20  			munmap(dom->interface, getpagesize());
    1.21 @@ -565,6 +563,16 @@ static int domain_create_ring(struct dom
    1.22  		dom->ring_ref = ring_ref;
    1.23  	}
    1.24  
    1.25 +	/* Go no further if port has not changed and we are still bound. */
    1.26 +	if (remote_port == dom->remote_port) {
    1.27 +		xc_evtchn_status_t status = {
    1.28 +			.dom = DOMID_SELF,
    1.29 +			.port = dom->local_port };
    1.30 +		if ((xc_evtchn_status(xc, &status) == 0) &&
    1.31 +		    (status.status == EVTCHNSTAT_interdomain))
    1.32 +			goto out;
    1.33 +	}
    1.34 +
    1.35  	dom->local_port = -1;
    1.36  	dom->remote_port = -1;
    1.37  	if (dom->xce_handle != -1)
    1.38 @@ -601,7 +609,7 @@ static int domain_create_ring(struct dom
    1.39  		}
    1.40  	}
    1.41  
    1.42 -	if (log_guest)
    1.43 +	if (log_guest && (dom->log_fd == -1))
    1.44  		dom->log_fd = create_domain_log(dom);
    1.45  
    1.46   out: