Skip to contentSkip to conversation

tmem: fix corner case crash on forcible domain destruction

PATCH New Dan Magenheimer 1 participant 1 message May 29, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tmem: fix corner case crash on forcible domain destruction

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.

xen/common/domain.c +5 -3
diff -r fe68405201d2 xen/common/domain.c
@@ -394,6 +394,11 @@ int domain_kill(struct domain *d)
         gnttab_release_mappings(d);
         /* fallthrough */
     case DOMDYING_dying:
+        if ( d->tmem != NULL )
+        {
+            tmem_destroy(d->tmem);
+            d->tmem = NULL;
+        }
         rc = domain_relinquish_resources(d);
         page_scrub_kick();
         if ( rc != 0 )
@@ -572,9 +577,6 @@ static void complete_domain_destroy(stru
     }
 
     grant_table_destroy(d);
-
-    if ( d->tmem != NULL )
-        tmem_destroy(d->tmem);
 
     arch_domain_destroy(d);
 
xen/common/tmem.c +0 -1
diff -r fe68405201d2 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);
 }

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.

xen/common/domain.c +5 -3
diff -r fe68405201d2 xen/common/domain.c
@@ -394,6 +394,11 @@ int domain_kill(struct domain *d)
         gnttab_release_mappings(d);
         /* fallthrough */
     case DOMDYING_dying:
+        if ( d->tmem != NULL )
+        {
+            tmem_destroy(d->tmem);
+            d->tmem = NULL;
+        }
         rc = domain_relinquish_resources(d);
         page_scrub_kick();
         if ( rc != 0 )
@@ -572,9 +577,6 @@ static void complete_domain_destroy(stru
     }
 
     grant_table_destroy(d);
-
-    if ( d->tmem != NULL )
-        tmem_destroy(d->tmem);
 
     arch_domain_destroy(d);
 
xen/common/tmem.c +0 -1
diff -r fe68405201d2 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);
 }
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel