[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] tmem: fix corner case crash on forcible domain destruction
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1243861666 -3600 # Node ID 50134a902c66d8c3d26a4bdca9257a8dfdd1c8c9 # Parent 45447c0f7c6efcfd9928626c23300149c119bc30 tmem: fix corner case crash on forcible domain destruction When a tmem-enabled domain is destroyed, if the domain was using a persistent pool, the domain destruction process to scrubs page races tmem's attempts to gracefully dismantle data structures. Move tmem_destroy earlier in the domain destruction process. Signed-off-by: Dan Magenheimer <dan.magenheimer@xxxxxxxxxx> Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx> --- xen/common/domain.c | 5 ++--- xen/common/tmem.c | 16 ++++++---------- 2 files changed, 8 insertions(+), 13 deletions(-) diff -r 45447c0f7c6e -r 50134a902c66 xen/common/domain.c --- a/xen/common/domain.c Mon Jun 01 14:02:26 2009 +0100 +++ b/xen/common/domain.c Mon Jun 01 14:07:46 2009 +0100 @@ -402,6 +402,8 @@ int domain_kill(struct domain *d) spin_barrier(&d->domain_lock); evtchn_destroy(d); gnttab_release_mappings(d); + tmem_destroy(d->tmem); + d->tmem = NULL; /* fallthrough */ case DOMDYING_dying: rc = domain_relinquish_resources(d); @@ -583,9 +585,6 @@ static void complete_domain_destroy(stru grant_table_destroy(d); - if ( d->tmem != NULL ) - tmem_destroy(d->tmem); - arch_domain_destroy(d); rangeset_domain_destroy(d); diff -r 45447c0f7c6e -r 50134a902c66 xen/common/tmem.c --- a/xen/common/tmem.c Mon Jun 01 14:02:26 2009 +0100 +++ b/xen/common/tmem.c Mon Jun 01 14:07:46 2009 +0100 @@ -867,7 +867,6 @@ static void client_free(client_t *client { list_del(&client->client_list); tmh_client_destroy(client->tmh); - tmh_set_current_client(NULL); tmem_free(client,sizeof(client_t),NULL); } @@ -1992,20 +1991,17 @@ EXPORT void tmem_destroy(void *v) { client_t *client = (client_t *)v; + if ( client == NULL ) + return; + if ( tmh_lock_all ) spin_lock(&tmem_spinlock); else write_lock(&tmem_rwlock); - if ( client == NULL ) - printk("tmem: can't destroy tmem pools for %s=%d\n", - cli_id_str,client->cli_id); - else - { - printk("tmem: flushing tmem pools for %s=%d\n", - cli_id_str,client->cli_id); - client_flush(client,1); - } + printk("tmem: flushing tmem pools for %s=%d\n", + cli_id_str, client->cli_id); + client_flush(client, 1); if ( tmh_lock_all ) spin_unlock(&tmem_spinlock); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |