diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2010-06-10 22:39:52 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2010-06-10 22:39:52 +0100 |
commit | 425bbceb733bfae83b6e4055b8db2ebcc497fb16 (patch) | |
tree | 47e71ec517cfbdd8b83f39ee312fc11b864e7de2 /xen/common/tmem.c | |
parent | c9b5c0a4b070dbe8e43d4b37309cde052a6e249a (diff) | |
download | xen-425bbceb733bfae83b6e4055b8db2ebcc497fb16.tar.gz xen-425bbceb733bfae83b6e4055b8db2ebcc497fb16.tar.bz2 xen-425bbceb733bfae83b6e4055b8db2ebcc497fb16.zip |
tmem: Fix domain lifecycle synchronisation.
Obtaining a domain reference count is neither necessary nor
sufficient. Instead we simply check whether a domain is already dying
when it first becomes a client of tmem. If it is not then we will
correctly clean up later via tmem_destroy() called from domain_kill().
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Diffstat (limited to 'xen/common/tmem.c')
-rw-r--r-- | xen/common/tmem.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/xen/common/tmem.c b/xen/common/tmem.c index 9ba20704a2..ffc07669db 100644 --- a/xen/common/tmem.c +++ b/xen/common/tmem.c @@ -1170,17 +1170,19 @@ static client_t *client_create(cli_id_t cli_id) if ( client == NULL ) { printk("failed... out of memory\n"); - return NULL; + goto fail; } memset(client,0,sizeof(client_t)); if ( (client->tmh = tmh_client_init(cli_id)) == NULL ) { printk("failed... can't allocate host-dependent part of client\n"); - if ( client ) - tmh_free_infra(client); - return NULL; + goto fail; + } + if ( !tmh_set_client_from_id(client, client->tmh, cli_id) ) + { + printk("failed... can't set client\n"); + goto fail; } - tmh_set_client_from_id(client, client->tmh, cli_id); client->cli_id = cli_id; #ifdef __i386__ client->compress = 0; @@ -1202,6 +1204,10 @@ static client_t *client_create(cli_id_t cli_id) client->succ_eph_gets = 0; client->succ_pers_gets = 0; printk("ok\n"); return client; + + fail: + tmh_free_infra(client); + return NULL; } static void client_free(client_t *client) |