ia64/xen-unstable

changeset 15644:eff24408830c

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>
author kfraser@localhost.localdomain
date Tue Jul 24 14:50:05 2007 +0100 (2007-07-24)
parents 531b8ccda973
children 2f22450e716d
files tools/xenstore/xenstored_domain.c
line diff
     1.1 --- a/tools/xenstore/xenstored_domain.c	Tue Jul 24 11:10:08 2007 +0100
     1.2 +++ b/tools/xenstore/xenstored_domain.c	Tue Jul 24 14:50:05 2007 +0100
     1.3 @@ -175,6 +175,8 @@ static int destroy_domain(void *_domain)
     1.4  	if (domain->interface)
     1.5  		munmap(domain->interface, getpagesize());
     1.6  
     1.7 +	fire_watches(NULL, "@releaseDomain", false);
     1.8 +
     1.9  	return 0;
    1.10  }
    1.11  
    1.12 @@ -197,7 +199,7 @@ static void domain_cleanup(void)
    1.13  				continue;
    1.14  		}
    1.15  		talloc_free(domain->conn);
    1.16 -		notify = 1;
    1.17 +		notify = 0; /* destroy_domain() fires the watch */
    1.18  	}
    1.19  
    1.20  	if (notify)
    1.21 @@ -247,7 +249,6 @@ static struct domain *new_domain(void *c
    1.22  	struct domain *domain;
    1.23  	int rc;
    1.24  
    1.25 -
    1.26  	domain = talloc(context, struct domain);
    1.27  	domain->port = 0;
    1.28  	domain->shutdown = 0;
    1.29 @@ -361,7 +362,7 @@ void do_introduce(struct connection *con
    1.30  		/* Now domain belongs to its connection. */
    1.31  		talloc_steal(domain->conn, domain);
    1.32  
    1.33 -		fire_watches(conn, "@introduceDomain", false);
    1.34 +		fire_watches(NULL, "@introduceDomain", false);
    1.35  	} else if ((domain->mfn == mfn) && (domain->conn != conn)) {
    1.36  		/* Use XS_INTRODUCE for recreating the xenbus event-channel. */
    1.37  		if (domain->port)
    1.38 @@ -414,8 +415,6 @@ void do_release(struct connection *conn,
    1.39  
    1.40  	talloc_free(domain->conn);
    1.41  
    1.42 -	fire_watches(conn, "@releaseDomain", false);
    1.43 -
    1.44  	send_ack(conn, XS_RELEASE);
    1.45  }
    1.46