aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/tmem.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-06-01 14:07:46 +0100
committerKeir Fraser <keir.fraser@citrix.com>2009-06-01 14:07:46 +0100
commitf475395032ee456f85242bd14fe59061b6d48b3f (patch)
treea9c940a1c0a0f9d2414dc4a1088feffe53a76645 /xen/common/tmem.c
parent630ec346adf58902b3ebc81321cf85ea2ffa826a (diff)
downloadxen-f475395032ee456f85242bd14fe59061b6d48b3f.tar.gz
xen-f475395032ee456f85242bd14fe59061b6d48b3f.tar.bz2
xen-f475395032ee456f85242bd14fe59061b6d48b3f.zip
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@oracle.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Diffstat (limited to 'xen/common/tmem.c')
-rw-r--r--xen/common/tmem.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/xen/common/tmem.c b/xen/common/tmem.c
index 0ab7b55c86..e40bc64505 100644
--- a/xen/common/tmem.c
+++ b/xen/common/tmem.c
@@ -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);